BookmarkSubscribeRSS Feed
SASSLICK001
Obsidian | Level 7

How can i draw following graph using sas? Any ideas would be appreciated. 001, 002 are patient numbers, the colored lines are a criterial presenting for each patient.

 

SASSLICK001_0-1616544346793.png

 

6 REPLIES 6
JosvanderVelden
SAS Super FREQ
Something like a grouped barchart?

See example: https://robslink.com/SAS/democd17/fruit_info.htm

Best regards, Jos
PhilC
Rhodochrosite | Level 12

A "Needle" plot:   SAS Help Center: Syntax: PROC SGPLOT NEEDLE Statement.  I've implemented graphs like this using a scatter plot; using points, which I make small or invisible, then I use error bars, without "feet", with the same size as the y coordinate.

 

The colors look random.  Would you be assigning colors to the needles based on your given data?

SASSLICK001
Obsidian | Level 7
Hi : Thanks for the solutions. I have too many subjects in the data, is there any way I can limit the number of subjects per page and create a multi page report.
Ksharp
Super User
data have;
 set sashelp.heart;
 id+1;
 if _n_=4 then stop;
 keep diastolic height weight id;
 format id z3.;
run;

proc transpose data=have out=want;
by id;
var  diastolic height weight;
run;
data want;
 set want;
 col1=-col1;
run;

proc sgplot data=want;
needle x=id y=col1/group=_name_ groupdisplay=cluster clusterwidth=0.2 x2axis;
x2axis type=discrete valuesformat=z3.;
run;

SGPlot5.png

SASSLICK001
Obsidian | Level 7
thanks for the quick response appreciate it , instead of needle , how can we use the bar
Ksharp
Super User
data have;
 set sashelp.heart;
 id+1;
 if _n_=4 then stop;
 keep diastolic height weight id;
 format id z3.;
run;

proc transpose data=have out=want;
by id;
var  diastolic height weight;
run;
data want;
 set want;
 col1=-col1;
run;

proc sgplot data=want;
vbar id/response=col1 group=_name_ groupdisplay=cluster clusterwidth=0.2 x2axis;
x2axis type=discrete valuesformat=z2.;
run;

SGPlot.png

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
  • 6 replies
  • 540 views
  • 8 likes
  • 4 in conversation