The script begins by creating a 'TumorSize' dataset simulating tumor size variation for 25 subjects across two treatment groups ('Treatment 1', 'Treatment 2'). It then generates two graphs. The first is a classic bar chart sorted by response. The second, after explicit data sorting, produces a similar but more advanced graph with a confidence band and a different bar appearance. The graphs are configured to be exported via ODS LISTING.
Data Analysis
Type : CREATION_INTERNE
The 'TumorSize' dataset is entirely generated in the first DATA step. It uses the ranuni function to simulate random data for 25 observations, representing patients and their tumor size variation.
1 Code Block
Configuration
Explanation : This block initializes macro variables for the output path and image resolution. It closes the ODS HTML destination and configures the ODS LISTING destination for graph output.
Copied!
%let gpath='.'; /*--Put your Folder Name here--*/
%let dpi=300;
ods html close;
ods listing gpath=&gpath image_dpi=&dpi;
1
%let gpath='.'; /*--Put your Folder Name here--*/
2
%let dpi=300;
3
ods html close;
4
ods listing gpath=&gpath image_dpi=&dpi;
2 Code Block
DATA STEP Data
Explanation : Generation of the 'TumorSize' table containing 25 observations. For each observation, an identifier (Cid), a change ('change'), a treatment group ('Group'), and a label ('Label') are randomly created.
Copied!
data TumorSize;
length Cid $ 3;
label Change='Change from Baseline (%)';
do Id=1 to 25;
cid=put(id, 2.0);
change=30-120*ranuni(2);
Group=ifc(int(ranuni(2)+0.5), 'Treatment 1', 'Treatment 2');
if mod(id, 5) = 1 then Label='C';
if mod(id, 5) = 2 then label='R';
if mod(id, 5) = 3 then label='S';
if mod(id, 5) = 4 then label='P';
if mod(id, 5) = 0 then label='N';
output;
end;
run;
Explanation : Creation of a first bar chart ('waterfall plot') using the SGPLOT procedure. It represents the change ('change') for each patient (Cid), grouped by treatment. The bars are ordered by response value (descending). Reference lines and legends are added for context.
Explanation : Sorting the 'TumorSize' table by the 'change' variable in descending order. The result is stored in a new table named 'TumorSizeDesc'.
Copied!
proc sort data=TumorSize out=TumorSizeDesc;
by descending change;
run;
1
2
PROC SORT
3
DATA=TumorSize out=TumorSizeDesc;
4
BY descending change;
5
RUN;
6
5 Code Block
PROC SGPLOT
Explanation : Creation of a second graph from the sorted data ('TumorSizeDesc'). It uses VBARPARM instead of VBAR because the data is already ordered. A band is added to mark a confidence zone (between -30 and 20). The appearance of the bars is modified with DATASKIN=PRESSED.
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.