BookmarkSubscribeRSS Feed
daradanye
Obsidian | Level 7

Hi,

 

I would like to do psmatch and also would like to have treatment and control on the same day and county without replacement.  Below is my code:

 

proc psmatch data=sg_to_match region=cs;
by fips1 visitday;
class treat;
psmodel treat = atq ;
match method=optimal(k=1) caliper=1;
output out(obs=match)=Outgs lps=_Lps matchid=_MatchID;
run;

But I got below error message:

 

WARNING: The maximum likelihood estimates for the logistic regression model might not exist. The
         maximum likelihood estimates are based on the last maximum likelihood iteration.
ERROR: Floating Point Zero Divide.
ERROR: Termination due to Floating Point Exception
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.OUTGS may be incomplete.  When this step was stopped there were 0
         observations and 13 variables.
WARNING: Data set WORK.OUTGS was not replaced because this step was stopped.

Is it because there might not be variations of treat/control in some county day?  Is there any way I can automatically ignore those county days?

 

Thanks!

4 REPLIES 4
mkeintz
PROC Star

@daradanye :  You ask

 


proc psmatch data=sg_to_match region=cs;
by fips1 visitday;
class treat;
psmodel treat = atq ;
match method=optimal(k=1) caliper=1;
output out(obs=match)=Outgs lps=_Lps matchid=_MatchID;
run;

But I got below error message:

 

WARNING: The maximum likelihood estimates for the logistic regression model might not exist. The
         maximum likelihood estimates are based on the last maximum likelihood iteration.
ERROR: Floating Point Zero Divide.
ERROR: Termination due to Floating Point Exception
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.OUTGS may be incomplete.  When this step was stopped there were 0
         observations and 13 variables.
WARNING: Data set WORK.OUTGS was not replaced because this step was stopped.

Is it because there might not be variations of treat/control in some county day?  Is there any way I can automatically ignore those county days?

You can begin to answer that question by generating a frequency of TREAT for each FIPS/VISITDAY (but only for cases with non-missing ATQ).  If on any given fips/visitday there is only one level of TREAT, there is no variation to be explained.  I presume that this could be very upsetting to PROC PSMATCH.   If you find such cases, then exclude those fips*visitday combinations from your analysis.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
daradanye
Obsidian | Level 7

Thanks for the reply.  Following your suggestions, I did the following things.  But it seems that it still does not work.

data sg_to_match;
set sg_to_match;
if atq =. then delete;
run;

proc sql;
create table sg_to_match as select 
*,sum(treat) as sumtreat, sum(control) as sumcontrol
from sg_to_match
group by fips1, visitday
order by fips1, visitday;
quit;

data sg_to_match;
set sg_to_match;
if sumtreat = 0 then delete;
if sumcontrol = 0 then delete;
run;

 

 

mkeintz
PROC Star

"still does not work." is vague.  But I assume you mean you are getting the same warning error messages as in your original note.  You will need help from others with experience with psmatch.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
ballardw
Super User

You are re-using the same named data set so many times I doubt that you know which version is actually used at any given point in this process. You may also previously have corrupted data. I suggest that it may be time to go back to when you originally read the data and NOT re-use the same data set name over and over.

In SAS every time you  use:

data sg_to_match;
set sg_to_match;

Or

create table sg_to_match

you completely replace any existing data set with that name. So a minor logic error when modifying values or selecting observations may have changed the values of your variables or other issues.

 

Also, unless you are very sure that you want to permanently remove for all purposes the observations where ATQ is missing i would suggest using a WHERE ATQ ne . ; in the Proc PSMATCH code.

 

You should also show the entire log for the procedure include the code and ALL the notes not just the errors.

 

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