BookmarkSubscribeRSS Feed
knveraraju91
Barite | Level 11

I need to add a line after a group variable. The following code works. The line appears after all groups of observations. But I need it have only after first group of observations. How to write a code.Thanks.

 

compute after grp/style={protectspecialchars=off};
line '\brdrt\brdrs ';
endcomp;

7 REPLIES 7
Ksharp
Super User

This kind of question should be posted at another forum ODS and Base Reporting  Cynthia is there .

 

Here is an example:

 

proc report data=sashelp.class nowd;
column age weight;
define age/group;
define weight/display;
compute after age/style(lines)={backgroundcolor=yellow};
n+1;
len=ifn(n=1,20,0);
dummy=' ';
line dummy $varying20. len;
endcomp;
run;
knveraraju91
Barite | Level 11

Thanks for your answer. It is worked. But it results in a wide line with yellow background. I need to keep normal  line. Can you please modify the code. Thanks

Ksharp
Super User

??

Remove

/style(lines)={backgroundcolor=yellow};
knveraraju91
Barite | Level 11

I am sorry that I am asking you again. I need a line ___________________________________________ like this. How to get this line after first group of observations. Thanks.

Reeza
Super User

Just a guess, but try combining your original code and @Ksharp code. Basically keep the n, which counts the number of groups and then add an if to your line statement. 

 

 

Ksharp
Super User

OK.

 

 

dummy='\brdrt\brdrs ';

 

 

And don't forget :

 

compute after grp/style={protectspecialchars=off};

 

 

Updated

knveraraju91
Barite | Level 11

Thank you all. It worked.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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