Question
a. I imported a .txt file and need to treat ALL dates as character variables. SAS doesn't need to know these values are dates, at
a. I imported a .txt file and need to treat ALL dates as character variables. SAS doesn't need to know these values are dates, at least for now.
b. Using the length function (not statement), I created a new variable called "lengthvar" that contains the length of each value of the event_dt variable. I know that the length function only works for character variables so I am not sure how I can use it on "Event_dt" since that is a numeric variable. I tried to use it on "Event_date" (a character variable I created) but it still does not work.
Are the codes below to create a new variable with the date as a character value instead of numeric value wrong? When I apply the length function to the variable "Event_date," I get the length 8 but some of them have lengths of 4 or 6.
for a:
data Ex.Demog;
set Ex.Demo;
Event_Date = put(Event_dt,8.);
Manufacturer_Date = put(mfr_dt,8.);
Initial_Case_Date = put(init_fda_dt,8.);
FDA_Recd_Date = put(fda_dt,8.);
Report_Sent_Date = put(rept_dt,8.);
run;
for b:
data Ex.demog_anosmia2;
set Ex.demog_anosmia;
lengthvar = length(Event_date);
run;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started