BookmarkSubscribeRSS Feed
thanikondharish
Fluorite | Level 6
Data ex;
Set sashelp.class ;
If age in (11,12) then flag=1 ;
If age in (13,14) the flag=2 ;
Else flag=3 ;
Run;

proc report data=ex;
Compute flag;
If flag=11 then do;
Call define (_row_,"style","style=[background=red]");
End;
Endcomp;
Run;

If run the above program I not getting colour.

4 REPLIES 4
andreas_lds
Jade | Level 19

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
Fluorite | Level 6
I wrote misspelled sorry, coming to point when I run proc report I am not
getting colour

andreas_lds
Jade | Level 19

@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;
Ksharp
Super User

If flag=11 then do;

should be

If flag=1 then do;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 1081 views
  • 0 likes
  • 3 in conversation