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.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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