Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[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)" <>
To   "" <>
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

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

 SET Combined ;
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. 



*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index