Hi all,
I am trying to replicate graphs I had made previously but need to make them journal ready. To do so, I need them to be black and white. I couldn't find my old code, but that is no problem because I viewed it as a learning experience.
My data looks like this
data work.trend ;
infile datalines dsd dlm='|' truncover;
input Trichot_1yr :$4. Expend Quadrimester :$2. Year :$15.
Category :$27.
;
format Trichot_1yr $4. Expend nlmny15.2 Quadrimester $2. Year $15.
Category $27.
;
informat Trichot_1yr $4. Quadrimester $2. Year $15. Category $27. ;
label Trichot_1yr='Trichot_1yr' Expend='Expend'
Quadrimester='Quadrimester' Year='Year' Category='Category'
;
datalines4;
RA|6079.44|Q1|Pre Resolution|Financial and Legal Affairs
3 The SAS System 11:02 Wednesday, July 22, 2020
UR|5881.45|Q1|Pre Resolution|Financial and Legal Affairs
RNA|8234.79|Q1|Pre Resolution|Financial and Legal Affairs
RA|5141.89|Q2|Pre Resolution|Financial and Legal Affairs
UR|5999.8|Q2|Pre Resolution|Financial and Legal Affairs
RNA|6912.39|Q2|Pre Resolution|Financial and Legal Affairs
RA|4896.44|Q3|Pre Resolution|Financial and Legal Affairs
UR|6160.41|Q3|Pre Resolution|Financial and Legal Affairs
RNA|6919.87|Q3|Pre Resolution|Financial and Legal Affairs
RA|5351.67|Q1|Post Resolution|Financial and Legal Affairs
UR|7391.1|Q1|Post Resolution|Financial and Legal Affairs
RNA|7357|Q1|Post Resolution|Financial and Legal Affairs
RA|5134.61|Q2|Post Resolution|Financial and Legal Affairs
UR|5645.89|Q2|Post Resolution|Financial and Legal Affairs
RNA|4168.32|Q2|Post Resolution|Financial and Legal Affairs
RA|4602.52|Q3|Post Resolution|Financial and Legal Affairs
UR|5323.38|Q3|Post Resolution|Financial and Legal Affairs
RNA|7600.25|Q3|Post Resolution|Financial and Legal Affairs
;;;;
After Financial and Legal, I will go to another category and create another panel graph. My question is when I use this bit of code it doesn't change the line attributes to shortdash, solid, and dot like it does for the colors. However, it will change the graphs to the first attribute whatever it is. I also wondered if there is a way to change the x and y axis labels without changing their variable names? Is that as simple as creating a label for them?
proc sgpanel data=trend;
panelby year / sort=descending spacing=5;
styleattrs
datacontrastcolors=(black grey34 greyAA)
datalinepatterns=(shortdash solid dot);
series x=Quadrimester y=expend / group=trichot_1yr markers markerattrs=(symbol=circlefilled size=9);
run;
To get both the colors and the patterns to cycle, set ATTRPRIORITY=NONE on the ODS GRAPHICS statement:
odd graphics / attrpriority=none;
As for the axis label, use the LABEL option on the ROWAXIS and COLAXIS statements:
roxaxis label="My Custom Label";
Hope this helps!
Dan
To get both the colors and the patterns to cycle, set ATTRPRIORITY=NONE on the ODS GRAPHICS statement:
odd graphics / attrpriority=none;
As for the axis label, use the LABEL option on the ROWAXIS and COLAXIS statements:
roxaxis label="My Custom Label";
Hope this helps!
Dan
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.