BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
anner
Fluorite | Level 6

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;
1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26
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.

 

 

 

 

View solution in original post

3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26
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.

 

 

 

 

anner
Fluorite | Level 6

Thank you for your quick reply RW9.  🙂

Amir
PROC Star

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.

Ready to join fellow brilliant minds for the SAS Hackathon?

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!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 6693 views
  • 2 likes
  • 3 in conversation