BookmarkSubscribeRSS Feed
AndreaLovdel
Calcite | Level 5

Hi all,

 

I can't code, so I am relying on the Task tool to graph my data which is working great so far. However my dataset is quite large, and I have different information about subjects such as their weight, height, temperature, blood pressure etc. I want to graph these in different graphs which I have managed fine too. However, I want each graph for each variable to have the specific y-axis unit, for ex for the temperature graph I want 'Celsius' on the y-axis, and for height to be 'cm' etc. I have one column with the data set, and another column with the 'original units'. Is there a way of customising the code the Task tool for line plot to add this in automatically? 

 

An ex that have that works for the title is the #byval(SubjectID), where I can put the code in the title, and then each graph will have the specific title based on the subject ID. I’ve tried to add the same byval function in the y-axis title #byval=(ColumnWithUnit) but it just displays the function.

 

I was advised to potentially create a macro variable for this, but again I don't know where to start with this, and where to insert it etc. 

 

When I use the Task tool to create a graph, in the settings, I get the option to customise the code that SAS EG creates for me as I change the properties of the graph. Is there any code that I can add there somewhere to make this work?

 

Thank you very much 🙂

Andrea 

1 REPLY 1
TomKari
Onyx | Level 15

I'm not 100% sure that I understand what you're after, but this might give you some ideas.

 

First, let's assume you're working with the "SASHELP.CARS" dataset. Among others, it has "Stores", "Sales", "Inventory", and "Returns" variables.

 

To emulate your dataset that contains the unit values for the different variables, I'm submitting this code:

 

data concurrence;
	length VarName $20 UnitName $20;
	input VarName UnitName;
	call symput(strip(varname), strip(UnitName));
	cards;
Stores Integer
Sales DollarsS
Inventory DollarsI
Returns DollarsR
run;

This will put values like "Integer" into macro variables like "Stores".

 

Now when you create your chart, on the Vertical Axis / Label text box, put your variable name preceeded by a & and followed by a dot. So if you're variable is "Sales", you would type "&Sales." (no double quotes!), and you would see DollarsS as the axis label.

 

Does this move you towards where you want to be?

 

Tom

 

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 1 reply
  • 383 views
  • 0 likes
  • 2 in conversation