logo_learn_stats

Find out how to Form Order Plots in SAS (With Examples)

Posted on
banner 336x280

You’ll utility proc sgplot to assemble sequence plots in SAS.

This process makes use of refer to unsophisticated syntax:

banner 468x60
/*assemble dataset*/
proc sgplot knowledge=my_data;
    form x=x_variable y=y_variable;
run;

Refer to examples display learn how to utility this process to assemble sequence plots in SAS.

Instance 1: Form Order Plot with One Order

Think we’ve got refer to dataset in SAS that presentations the overall gross sales made via a bind all the way through 10 consecutive days:

/*assemble dataset*/
knowledge my_data;
    enter generation $ gross sales;
    datalines;
1 7
2 12
3 15
4 14
5 13
6 11
7 10
8 16
9 18
10 24
;
run;

/*view dataset*/
proc print knowledge=my_data;

We will utility proc sgplot to assemble a sequence plot that presentations the generation at the x-axis and gross sales at the y-axis:

/*assemble sequence plot that presentations gross sales via generation*/
proc sgplot knowledge=my_data;
    form x=generation y=gross sales;
run;

We will utility refer to code to change the semblance of the chart, together with the identify, labels, colours, sequence trend, and sequence thickness:

/*assemble customized sequence plot*/
identify "Gross sales via Life";
proc sgplot knowledge=my_data;
    form x=generation y=gross sales / lineattrs=(colour=purple trend=sprint thickness=4);
    xaxis show=(nolabel noline noticks);
run;
identify; 

Instance 2: Form Order Plot with More than one Traces

Think we’ve got refer to dataset in SAS that presentations the overall gross sales made via 3 other retail outlets all the way through 5 consecutive days:

/*assemble dataset*/
knowledge my_data;
    enter bind $ generation $ gross sales;
    datalines;
A 1 13
A 2 18
A three 20
A 4 25
A 5 26
B 1 3
B 2 7
B 3 12
B 4 12
B 5 11
C 1 6
C 2 12
C 3 19
C 4 20
C 5 21
;
run;

/*view dataset*/
proc print knowledge=my_data;

We will utility proc sgplot with the team argument to assemble a sequence plot that presentations the gross sales made via each and every of the 3 retail outlets:

/*assemble sequence plot that presentations gross sales via generation for each and every bind*/
identify "Gross sales via Life via Collect";
proc sgplot knowledge=my_data;
    styleattrs datacontrastcolors=(purple inexperienced blue);
    form x=generation y=gross sales / team=bind;
run;
identify;

The x-axis presentations the generation and the y-axis presentations the gross sales made via the retail outlets.

The 3 person strains display the gross sales made via each and every of the 3 retail outlets all the way through each and every generation.

Extra Sources

Refer to tutorials provide an explanation for learn how to assemble alternative familiar visualizations in SAS:

Find out how to Form Boxplots via Workforce in SAS
Find out how to Form a Scatterplot with Regression Order in SAS

banner 336x280

Leave a Reply

Your email address will not be published. Required fields are marked *