BookmarkSubscribeRSS Feed
SHESADEV
Calcite | Level 5

Hi All,

 

I m trying to do sas date function using sas macro and i need below output.

 

%let a= %sysfunc(intnx(day,%sysfunc(today()),-1),yymmdd10.);

 

Output

2017-10-26.

 

but need output should be .

'2017-10-26'

 

within the code.

 

Please guide me how would be do it.

5 REPLIES 5
PeterClemmensen
Tourmaline | Level 20
data _null_;
   date=today()-1;
   format date yymmdd10.;
   put date;
run;
mkeintz
PROC Star

If you have to do this in macro, you could precede and follow you expression with %str(%'), as in:

 

%let a=    %str(%')%sysfunc(intnx(day,%sysfunc(today()),1),yymmdd10.)%str(%');
%put &=a;
--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
SHESADEV
Calcite | Level 5
Thank a lots.
worked it.
Reeza
Super User

Personally I'm not a fan of including quotes in macro variables, I prefer to leave them unquoted and then use with quotes as necessary. It makes them more versatile in the long run and allows for multiple uses.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 5 replies
  • 786 views
  • 0 likes
  • 5 in conversation