BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
1 ACCEPTED SOLUTION

Accepted Solutions
Shmuel
Garnet | Level 18

You have not supplied a sample data nor expected results.

You can remove first step and try next code:

proc sql;
  create table reportsummary as 
  select reportName, 
         count(key_num_acct) as reports_vol 
  from permdata.reportreferrals
  where reportDT = today() - 2. 
  group by reportName;
quit;

View solution in original post

4 REPLIES 4
Shmuel
Garnet | Level 18

You have not supplied a sample data nor expected results.

You can remove first step and try next code:

proc sql;
  create table reportsummary as 
  select reportName, 
         count(key_num_acct) as reports_vol 
  from permdata.reportreferrals
  where reportDT = today() - 2. 
  group by reportName;
quit;
PaigeMiller
Diamond | Level 26

Macro variables SHOULD NOT be formatted.

 

data _null_;
    call symput('today',intnx('day',today(),-2));
run;

But @Shmuel has a simpler approach.

--
Paige Miller
Tom
Super User Tom
Super User

Why would you want to compare REPORTDT to a number that is less than 1 thousandths?  

 

625   data test;
626     x=31/07/2020 ;
627     put x=;
628   run;

x=0.0021923621

Isn't REPORTDT a DATE variable?  Wouldn't you want to compare it to another date value?   The date value for 31JUL2020 is 22127.

Either set the macro variable to the number of days. 

call symputX('today',today()-2);

Or set it to a string that the DATE informat can recognize and use it make a date literal in your later code.

call symputX('today',put(today()-2,date9.));
...
where reportDT = "&today"d

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 4 replies
  • 563 views
  • 1 like
  • 5 in conversation