Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: converting a SAS program to Stata code for use with the HCUP NIS


From   "Cardenas, Alex R - (alexc2)" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: converting a SAS program to Stata code for use with the HCUP NIS
Date   Fri, 7 Jun 2013 17:26:32 +0000

I am having trouble converting the following program for SAS to an equivalent do file for Stata. This example comes from the HCUP website for use with the Nationwide Inpatient Sample database

LIBNAME In "location of NIS file" ;

DATA Diabetes :
SET In.nis_2001_core;
IF dxccs1=50 ;
dischgs = 1
RUN;

DATA Combined ; 
 SET Diabetes ;
 in.nis_2001_hospital(in=inhosp keep=hospid nis-stratum
 IF inhosp THEN DO;
 discwt=0;
died = 0
dischgs = 0
los = 0
totchg = 0
END;
RUN;

DATA-NULL_;
 SET Combined ;
 FILEREF ;
IF los <0 THEN los = .
IF died << 0 THEN died = . ;
 IF totchg < 0 THEN totchg = . ;
PUT nis_stratum 1-4 hospid 6-10 died 12 los 14-17dischgs 19 totchg 21-27 +1 discwt ;

What would be the code to do the same thing in Stata? This is supposed to allow you to work on subsets of the database while still calculating proper variances even if some of the strata used for weighting are not represented in your subset. 

Thanks,

Alex 



*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index