When i execute the code posted i get the following warning:
26 Data ex;
27 Set sashelp.class ;
28 If age in (11,12) then flag=1 ;
29 If age in (13,14) the flag=2 ;
___
1
WARNING 1-322: Assuming the symbol THEN was misspelled as the.
After fixing this, there is a note, that indicates another error:
33 proc report data=ex;
34 Compute flag;
35 If flag=1 then do;
36 Call define (_row_,"style","style=[background=red]");
37 End;
38 Endcomp;
39 Run;
NOTE: Variable flag is uninitialized.
NOTE: There were 19 observations read from the data set WORK.EX.
NOTE: PROZEDUR REPORT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
I can only recommend to use
options dsoptions=note2err;
To turn all unexpected notes into error-messages.
Now back to your problem: what do you want to achieve?
@thanikondharish wrote:
I wrote misspelled sorry, coming to point when I run proc report I am not
getting colour
You wrote that already, but this doesn't answer my question.
How many observations have flag = 11?
Adding a define-statement for the variable flag seems to solve the error-message:
define flag / display;
If flag=11 then do;
should be
If flag=1 then do;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.