I am trying to figure out how to get my data to print where month, day, and year are in the following format mm/dd/yyyy. I used the catx statement I found in another post. But I don't know how to make date show in the print statement. I thought I could just insert the word date in my proc print var statement, but SAS erred saying date is missing. Below is what I have in my program. Thank you for any suggestions. - Anne I am using SAS 9.3.
data b18;
INFILE 'm:\OFFICE\18BR.DAT' LRECL=2538 MISSOVER;
inPUT
@6 cert 6.
@116 year 4.
@120 mnth 2.
@122 day 2.
@314 rescty 2.
@128 LOC_ST 2.
@2425 OOSCERT 10.;
RUN;
data want;
set b18;
date=input(catx("/",mnth,day,year),mmddyy10.);
format date mmddyy10.;
run;
PROC PRINTdata=b18;
VAR LOC_ST OOSCERT RESCTY mnth day year;
run;
data want; set b18; date=mdy(mnth,day,year); format date mmddyy10.; run; proc print data=want; var loc_st ooscert rescty date; run;
Please avoid coding in upper case.
data want; set b18; date=mdy(mnth,day,year); format date mmddyy10.; run; proc print data=want; var loc_st ooscert rescty date; run;
Please avoid coding in upper case.
Thank you for your quick reply RW9. 🙂
Hi,
I think your code will work, you just need to replace b18 with want in your proc pint, which is why you're getting an error about date being missing because it does not exist on b18.
Regards,
Amir.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: