BookmarkSubscribeRSS Feed
_LB
Fluorite | Level 6 _LB
Fluorite | Level 6
Hello all-
another possible brain teaser that any assistance would be much appreciated-

I have a macro that takes all the units and produces a graph for each unit. So far, no difficulty except that I would like to change two things:

Based on a specific unit I would to be able to change the refline statement as needed.

Also, is there is any way to use if/then statements in the footnotes of each graph that incorporate data from other macros-

The code is shown below, any assistance much appreciated!
LB


%macro split (data=, var=);
proc sort data=&data(keep=&var) out=values nodupkey;
by &var;
run;
data _null_;
set values end=last;
call symputx('site'||left(_n_),&var);
if last then call symputx('count',_n_);
run;
%put _local_;


DATA _NULL_ ;
select(&var);
%do i=1 %to &count;


/*CRBSI GRAPHS */

ODS GRAPHICS ON /IMAGEFMT=PNG HEIGHt=3in width=5in SCALE=OFF ANTIALIAS=ON IMAGENAME="CRBSI_&&site&i" BORDER=NO;
title "&&site&i";

proc sgplot data=BASIC_OUT_II NOAUTOLEGEND ;
WHERE UNIT1 IN ("&&site&i") and _type_ =7 and moi>'30Aug07'd;


series x=Moi2 y=CRBSI_RATE /
datalabel=CRBSIgraph
lineattrs=(pattern=solid thickness=2px color=blue)
markerattrs=(symbol=circlefilled )

markers group=UNIT1;
yaxis label='CRBSI Rate per 1000 DD' GRID VALUES = (0 TO 15 BY 2.5);
xaxis label =' ';
REFLINE 4.56 / TRANSPARENCY = .1 LINEATTRS=(pattern=dot thickness=3px color=green)
LABEL = ('UCSF IAP Goal:4.56') LABELLOC=OUTSIDE ;
REFLINE .5 / TRANSPARENCY = .1 LINEATTRS=(pattern=dot thickness=3px color=red)
LABEL = ('NHSN 25%ile (.5)' ) LABELLOC=OUTSIDE ;
run;

footnote goes here.

ODS GRAPHICS OFF;
8 REPLIES 8
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
The SAS macro language also has %IF / %THEN logic, and you can use SAS macro variables which get resolved at SAS compilation time - you can use macro variables you name in your program to substitute string values, such as you mentioned with your REFLINE.

Have a look at the SAS support website http://support.sas.com/ where there is SAS-hosted documentation, specifically the SAS MACRO LANGUAGE documentation.


Scott Barry
SBBWorks, Inc.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
The SAS macro language also has %IF / %THEN logic, and you can use SAS macro variables which get resolved at SAS compilation time - you can use macro variables you name in your program to substitute string values, such as you mentioned with your REFLINE.

Have a look at the SAS support website http://support.sas.com/ where there is SAS-hosted documentation, specifically the SAS MACRO LANGUAGE documentation.


Scott Barry
SBBWorks, Inc.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
The SAS macro language also has %IF / %THEN logic, and you can use SAS macro variables which get resolved at SAS compilation time - you can use macro variables you name in your program to substitute string values, such as you mentioned with your REFLINE.

Have a look at the SAS support website http://support.sas.com/ where there is SAS-hosted documentation, specifically the SAS MACRO LANGUAGE documentation.


Scott Barry
SBBWorks, Inc.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
The SAS macro language also has similar IF / THEN logic using percent signs, and you can use SAS macro variables which get resolved at SAS compilation time - you can use macro variables you name in your program to substitute string values, such as you mentioned with your REFLINE.

Have a look at the SAS support website http://support.sas.com/ where there is SAS-hosted documentation, specifically the SAS MACRO LANGUAGE documentation.


Scott Barry
SBBWorks, Inc.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
The SAS macro language also has %IF / %THEN logic, and you can use SAS macro variables which get resolved at SAS compilation time - you can use macro variables you name in your program to substitute string values, such as you mentioned with your REFLINE.

Have a look at the SAS support website http://support.sas.com/ where there is SAS-hosted documentation, specifically the SAS MACRO LANGUAGE documentation.


Scott Barry
SBBWorks, Inc.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
The SAS macro language also has %IF / %THEN logic, and you can use SAS macro variables which get resolved at SAS compilation time - you can use macro variables you name in your program to substitute string values, such as you mentioned with your REFLINE.

Have a look at the SAS support website http://support.sas.com/ where there is SAS-hosted documentation, specifically the SAS MACRO LANGUAGE documentation.


Scott Barry
SBBWorks, Inc.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
The SAS MACRO language has macro variables used for data passing (using the %GLOBAL) and substituation (for example, in your REFLINE and FOOTNOTEn statement). Also, the macro language has %IF / %THEN statements you can use for conditional logic processing, as you have requested. Have a look at the SAS product documentation's Macro Language manual at the SAS support website http://support.sas.com/ for details and syntax coding.

Scott Barry
SBBWorks, Inc.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
The SAS MACRO language has macro variables used for data passing (using the %GLOBAL) and substituation (for example, in your REFLINE and FOOTNOTEn statement). Also, the macro language has %IF / %THEN statements you can use for conditional logic processing, as you have requested. Have a look at the SAS product documentation's Macro Language manual at the SAS support website http://support.sas.com/ for details and syntax coding.

Scott Barry
SBBWorks, Inc.

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
  • 8 replies
  • 987 views
  • 0 likes
  • 2 in conversation