BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
cmc_NYC
Fluorite | Level 6

Hello all, 

I have developed a model to test the impact of a 2017 event on distress in a population and it was run by a research center using data to which I don't have access. I'm having trouble finding sample code for using this output to create a display like this.  I'm now working with the output and trying to display the coefficients in a graphic that looks something like this.  (This is from Warton et al 2020) For this particular display I would just have one line not two. 

Sample from Warton.jpg

 I have two kinds of output that seem relevant:

1) The mean distress score for the group each year from 2011 to 2018. Here's my first pass at that program, that shows those scores.  This did not work. In particular, I'm not seeing how to create the vertical line indicating the event in 2017

 

Data AimII_Table2;
input TimeElapsed Time Distress Event $;
datalines;
0 2011 3.7339771 Before
1 2012 3.8688698 Before
2 2013 3.8669976 Before
3 2014 3.5876379 Before
4 2015 3.64495 Before
5 2016 3.4850532 Before
6 2017 3.6610487 After
7 2018 3.5467001 After
;

2) The coefficients for the univariate regression, so coefficients for time, before and after the event, and the interaction terms for time*after the event

Estimated Regression Coefficients
ParameterEstimateStandard
Error
t ValuePr > |t|
Intercept3.85931320.0664016358.12<.0001
TimeElapsed-0.06447080.02134668-3.020.0025
AfterEvent After Event0.48782680.843697620.580.5631
AfterEvent Before Event0.00000000.00000000..
TimeElapsed*AfterEvent After Event-0.04987780.13118431-0.380.7038
TimeElapsed*AfterEvent Before Event0.00000000.00000000..

 

Thank you for any ideas!  

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
You need to add a value for where you want the refline and specify the axis.

refline 2017 / axis=x label='Event 2017';

Ref Lines examples:
https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatproc/n19gxtzyuf79t3n16g5v26b73ckv.htm#n...

View solution in original post

3 REPLIES 3
cmc_NYC
Fluorite | Level 6
Sorry, with the mean distress levels by year I used this code following the data lines above.

Proc sgplot data=AimII_Table2;
scatter x=Time y=Distress;
series x=Time y=Distress;
reg x=Time y=Distress/group=Election;
refline
run;
Reeza
Super User
You need to add a value for where you want the refline and specify the axis.

refline 2017 / axis=x label='Event 2017';

Ref Lines examples:
https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatproc/n19gxtzyuf79t3n16g5v26b73ckv.htm#n...
cmc_NYC
Fluorite | Level 6
Thank you. I had lots of examples of REFLINE code, but just needed something that broke down how that worked.

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Early bird rate extended! Save $200 when you sign up by March 31.

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1103 views
  • 3 likes
  • 2 in conversation