Dear all,
I have a question about I created a swimmer plot with this dataset:
data test; input pat_id 2. startline1 5. endline1 5. startline2 5. endline2 5. status 6. startyear 5. diagnosisyear 5. lastfollowup 5.; datalines; 1 2000 2011 2000 2011 2 2001 2010 2010 2010 -0.25 2001 2010 2010 3 2002 2019 2002 2019 4 2003 2009 2003 2009 5 2004 2013 2019 2019 2004 2013 2019 6 2005 2014 2018 2018 2005 2014 2018 7 2006 2015 2018 2018 2006 2015 2018 8 2007 2007 2007 2007 9 2008 2015 2017 2017 2008 2015 2017 10 2009 2012 2017 2017 -0.25 2009 2012 2017 11 2010 2016 2010 2016 12 2011 2015 2011 2015 13 2012 2020 2020 2020 -0.25 2012 2020 2020 14 2013 2016 2013 2016 ; run;
proc sgplot data= test noautolegend;
hbarparm category = pat_id response=diagnosisyear / barwidth=0.5;
highlow y=pat_id low=startline1 high=endline1 / lineattrs=(thickness=2 pattern=solid color=blue);
highlow y=pat_id low=startline2 high=endline2 / lineattrs=(thickness=2 pattern=solid color=darkred) ;
yaxis type=discrete display=(nolabel);
xaxis grid type=linear display=(nolabel) values=(2000 to 2020 by 1);
scatter y=pat_id x=startyear /markerattrs=(symbol=trianglefilled size=9 color=yellow) name="a" legendlabel="start-year";
scatter y=pat_id x=diagnosisyear /markerattrs=(symbol=circlefilled size=9 color=green) name="b" legendlabel= "Diagnosis-year";
scatter y=pat_id x=lastfollowup /markerattrs=(symbol=squarefilled size=9 color=pink) name="c" legendlabel= "Last fpllowup";
scatter y=pat_id x=status /markerattrs=(symbol=starfilled size=9 color=black) name="d" legendlabel= "Status";
Keylegend "a" "b" "c" "d" / noborder location=outside position=topright across=0;
run;
my problem is I want the status to be displayed as the example on graphically speaking like the "durable responder" is displayed but I can't get it working. Any help?
Many users here don't want to download Excel files because of virus potential, others have such things blocked by security software. Also if you give us Excel we have to create a SAS data set and due to the non-existent constraints on Excel data cells the result we end up with may not have variables of the same type (numeric or character) and even values.
Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the </> icon or attached as text to show exactly what you have and that we can test code against.
Dear all,
I have changed the excel sheet to a datastep. I will appreciate any help
I realised that my x-axis starts from 2000 to 2020 that is maybe why the minus 0.25 cannot be displayed. Any idea how I can solve this?
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.