BookmarkSubscribeRSS Feed
thanikondharish
Calcite | Level 5
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
Calcite | Level 5
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;

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
  • 467 views
  • 0 likes
  • 3 in conversation