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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.