BookmarkSubscribeRSS Feed
iSAS
Quartz | Level 8

Below is my sample data:

 

data have;
infile datalines
dlm='|';
input Directory $ Date SizeInMB;
informat Date Date9.;
format Date Date9.;
datalines;
Folder 1|'13Mar2021'd|20
Folder 1|'14Mar2021'd|26
Folder 1|'15Mar2021'd|14
Folder 2|'13Mar2021'd|250
Folder 2|'14Mar2021'd|110
Folder 2|'15Mar2021'd|300
Folder 3|'13Mar2021'd|.89
Folder 3|'14Mar2021'd|4
Folder 3|'15Mar2021'd|3
;
run;

 

May I know how to graph it wherein:

1. The date will be in the x-axis

2. SizeInMb will be in the y-axis

3. The directories will be in the line graph (So there will be a legend)

 

I would also want to divide the graph by their sizes. Example, folders with SizeinMB ranging from 100 to 100MB will be in Graph1, filders with sizes ranging from 101 to 200 will be in Graph2, and so on and so forth

2 REPLIES 2
PaigeMiller
Diamond | Level 26
proc sgplot data=have;
    scatter x=date y=sizeinmb/group=directory;
run;

For the part of your problem that says "I would also want to divide the graph by their sizes. Example, folders with SizeinMB ranging from 100 to 100MB will be in Graph1, filders with sizes ranging from 101 to 200 will be in Graph2, and so on and so forth".

 

You would have to create a variable in the data set which indicates the size of the folder, and then in PROC SGPLOT, you would use a BY statement.

--
Paige Miller
Ksharp
Super User
You want this ?


data have;
infile datalines
dlm='|';
input Directory $ Date SizeInMB;
informat Date Date9.;
format Date Date9.;
datalines;
Folder 1|'13Mar2021'd|20
Folder 1|'14Mar2021'd|26
Folder 1|'15Mar2021'd|14
Folder 2|'13Mar2021'd|250
Folder 2|'14Mar2021'd|110
Folder 2|'15Mar2021'd|300
Folder 3|'13Mar2021'd|.89
Folder 3|'14Mar2021'd|4
Folder 3|'15Mar2021'd|3
;
run;

proc sgplot data=have;
series x=date y=SizeInMB /group=Directory;
run;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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