Data visualization with SAS programming

How do I change panel headings in proc sgplot?

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 9
Accepted Solution

How do I change panel headings in proc sgplot?

Greetings,

 

I am using Proc SGPanel to create two histograms for different levels of the same variable (named "LGBQ"). LGBQ is coded to have values of either 1 or 2; I have used Proc Format to indicate that 1 = Heterosexual and 2 = LGBQ. When I use Proc SGPanel, the two panels are labeled "LGBQ=1" and "LGBQ=2". Is there a way to have Proc SGPanel pull the formatted labels instead of the values for the variables? Or to alter the headings for each column? I'm using SAS Enterprise Guide 4.3. Any help or insight would be greatly appreciated.

 

I'm a relative SAS newbie and couldn't find any articles or posts that addressed this issue; apologies if there is one already that I missed.

 

 

Thanks,

 

Andrew


Accepted Solutions
Solution
‎07-21-2016 12:13 PM
Grand Advisor
Posts: 9,748

Re: How do I change panel headings in proc sgplot?

Showing the code you used would help.

 

Did you actually use assign the format to the variable in either the data set or the SGPANEL? it would look like this:

Format LBGQ formatname. ;

View solution in original post


All Replies
Solution
‎07-21-2016 12:13 PM
Grand Advisor
Posts: 9,748

Re: How do I change panel headings in proc sgplot?

Showing the code you used would help.

 

Did you actually use assign the format to the variable in either the data set or the SGPANEL? it would look like this:

Format LBGQ formatname. ;

Occasional Contributor
Posts: 9

Re: How do I change panel headings in proc sgplot?

I used this code for proc sgpanel:

 

proc sgpanel data=D1; panelby LGBQ / uniscale=all; histogram VictimLGBT; density VictimLGBT; run;

 

And I formatted the dataset using this statement (earlier in the program than proc sgpanel:

 

proc format; value LGBQ 1 = "Heterosexual" 2 = "LGBQ"; run; 

Occasional Contributor
Posts: 9

Re: How do I change panel headings in proc sgplot?

[ Edited ]

Ah. Now I see what you mean. I added a format statement [ format LGBQ LGBQ.; ], and it produced the desired results. Thank you!

Super Contributor
Posts: 252

Re: How do I change panel headings in proc sgplot?

Greetings, I thought the formatted value will be shown automatically as long as you are also using the format statement? Have you used the format statement within your proc sgpanel?

 

Thanks

Post a Question
Discussion Stats
  • 4 replies
  • 243 views
  • 0 likes
  • 3 in conversation