BookmarkSubscribeRSS Feed
DB_ECON
Calcite | Level 5
proc gplot data=abc;
plot x1*date ;
where x3='1: < 24';
by x4 ;
run;
quit;

x4 is a character variable. THe abovecode generates a separate graph for each value in x4. How do I overlay all the series in one graph
3 REPLIES 3
Cynthia_sas
SAS Super FREQ
Hi:
Look at this example in the doc:
http://support.sas.com/documentation/cdl/en/graphref/63022/HTML/default/viewer.htm#/documentation/cd...

Of particular relevance to your question is the syntax:
[pre]
plot faren*month=city / .... more options ....;
[/pre]

cynthia
GraphGuy
Meteorite | Level 14
There are basically 2 ways to overlay lines in gplot ...

As Cynthia mentioned, you can probably use "plot y*x=z" (where z is what you were using as the by variable).

Or, you can use something like "plot y1*x y2*x y3*x / overlay" - for this technique, you'd probably have to transpose your data, and it requires hard-coding all the (new) variable names in the plot statement. It's hard to get real specific without seeing the exact data, but basically you would have to transpose your data (proc transpose) so that you're basically turning the text values into variable names, with the x1 numeric values becoming the values of the new variables.

You'll probably want to go with Cynthia's technique, but just wanted to mention the 2nd alternative!
DB_ECON
Calcite | Level 5
Thanks Cynthia and Robert for your suggestions...

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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