/* HAVE */
/* First import the csv data file */
data work.import;
infile "P:\TEMP\DummyData.csv"
delimiter = "|"
missover
dsd
firstobs=2;
informat DummyName $50.;
informat wknr 2.;
informat yr_range $9.;
informat nodum 10.;
format DummyName $50.;
format wknr 2.;
format yr_range $9.;
format nodum 10.;
input
DummyName
wknr
yr_range
nodum
;
run;
/* Then this is how many distinct graphs we should produce: in this case 8 */
proc sql;
create table imp_sg_tot as
select distinct DummyName from work.import
order by DummyName;
quit;
/* Data which should be used to show on graphs */
PROC SQL;
CREATE table IMP_SG AS
SELECT *, max(wknr) as maxwk, min(wknr) as minwk, max(nodum) AS maxaant
FROM work.IMPORT
GROUP BY DummyName,yr_range
ORDER BY DummyName,yr_range,wknr;
QUIT;
/* WANT */
/*
1 sgplot graph for each _n_ in dataset "IMP_SG_TOT" (n=1 to 8) from dataset "IMP_SG".
On the horizontal axis there should show: wknr
On the vertical axis: nodum
Data should be grouped by(?) DummyName.
And all yr_ranges show as lines (different color/type lines) on this particular graph.
So.. for DummyName on _N_=1 (='Dum- & Dat') there should be 2 graphs like this:
-first graph shows 5 lines for yr-ranges: 2016-2017, 2017-2018, 2018-2019, 2019-2020 and 2020-2021.
-and second graph shows only 1 line for yr-range: 2022-2023
I don't want to use sgpanel. Only sgplot. Is this possible?
I hope you guys understand what i mean... and above all: i hope someone can help me out with graphing!
I really don't have that much experience with graphing the data.... :-(
Thanks in Advance!
*/
Well it says it all in my SAS-code actually...
I hope someone can help me out! 🙂
And the data i use is as attachment: csv-file
Edit:
Sorry.. forget something!
Why I am making extra columns (with max & min wknr and max nodum) is because I want the graphs to show the min and max wknr on the axis automatically based on this column values! Idem. for the max nodum on the vertical axis.
I hope you guys/girls understand what I mean. 🙂
Edit2: @ballardw yes, I mean they are limits of the axis! Thank you!
@Reeza that are the graphs I want yes! But only 2 graphs per DummyName:
1) with all the years (except for 2022-2023) (so you get 5 vlines in 1 graph)
2) only 2022-2023 year (so you get 1 vline in 1 graph) This is my picture - please note: it contains only year 2016-2017, but it must contain 5 vlines/groups of years.
Hopefully it is clear to you guys now? If not, please let me know! I will clear it more for you if needed. I'm still learning... 🙂
... View more