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

Hi.  I am conducting a difference in differences analysis of a policy. I intend to check whether there is a parallel trend for an intervention site and a comparison site. Since the outcome variable is binary at individual level, I've run a regression in surveylogistic procedure. The model is:

 

Outcomeit=Intervention + Montht + Intervention * Montht + xit + ϵit

 

Outcome is a dummy variable. Intervention is a dummy variable with 1 for the intervention site and 0 for the comparison site. Month is a categorical variable (not continuous) for the period before the policy got effective. Intervention * Montht is the interactions between Intervention and Montht (i.e. since Month is categorical, there are multiple interaction terms ). X is a vector of individual characteristics, and ϵ is the error term. 

 

To test whether the two sites have parallel trend, I need to perform a F-test on the coefficients of all interaction terms jointly. The issue is when I used the code “test1: test Intervention * Month;” after the line of code for Model, I got an error message. However, I could use the same line of test code for coefficients of other independent variables in the model such as Month (i.e. “test1: test Month;”). Can anyone suggest how I can perform a F-test for all interaction terms jointly in SAS?  Thanks.

1 ACCEPTED SOLUTION
5 REPLIES 5
PaigeMiller
Diamond | Level 26

Show us the log for PROC SURVEYLOGISTIC, the entire log for PROC SURVEYLOGISTIC, with nothing chopped out, from the PROC SURVEYLOGISTIC statement all the way down to the last NOTE after PROC SURVEYLOGISTIC.

 

Please format the log for easy readability, by copying the log as text and pasting it into the window that appears when you click on the </> icon.

--
Paige Miller
ballardw
Super User

Adding just a bit to @PaigeMiller's comment:

 

Best practice on this forum for any question regarding any error, warning or note from the log is to copy from the log the entire procedure or data step code and all the messages for that block of code and paste into a text box opened with the </> icon.

The text box preserves formatting of text when SAS supplies diagnostic indicators which can get shifted by the main message windows. Plus the appearance of the block offsets the code from the discussion text visually. Pasting as text is also important as often we can provide code corrections or highlights by copy/edit/paste that just are not possible with images.

The entire block of code is needed because in many procedures some options require other options to be set. Or the proverbial "missing semicolon" failing to end a previous code statement lines above the reported error may be the cause.

 

Also we want the code from the log as that shows exactly what was submitted. It is amazing just how often we see a question about "I ran this code and xxxx did/ did not happen" where the "code" pasted will not run or cannot possibly generate the described behavior because no variable or option of the type is used in the code that an error reports.

SAS41
Calcite | Level 5

Thank both of your for your feedback. This following is a part of the log to illustrate the issue. Basically, I want to do a F-test of all interaction terms jointly for the parallel trend assumption.

629  proc surveylogistic data=data;
NOTE: PROCEDURE SURVEYLOGISTIC used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

NOTE: The SAS System stopped processing this step because of errors.
630  class intervention month agegroup ;
631  model outcome= intervention month intervention*month agegroup / DF=INFINITY ridging=absolute
631! ;
632  test1: test month1=month2;
633  test2: test month1=month2=month3=0;
634  test3: test intervention*month1=intervention*month2;
                             -
                             22
                             76
ERROR 22-322: Syntax error, expecting one of the following: ;, +, ',', -, /, =, {.
ERROR 76-322: Syntax error, statement will be ignored.
635  run;


SAS_Rob
SAS Employee

It sounds like all you really want is the Type3 test for the interaction which should be part of the default output when you run:

proc surveylogistic;

class intervention month/param=glm;

model reponse=intervention|month;

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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 882 views
  • 1 like
  • 4 in conversation