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: RE: Replacing variable values after using collapse command
From
"Martin Weiss" <[email protected]>
To
<[email protected]>
Subject
st: RE: Replacing variable values after using collapse command
Date
Mon, 5 Jul 2010 23:03:23 +0200
<>
You may want to use -collapse- again:
***********
clear*
input double oshpd_fac_no str30 facility_name int snf_medcare_days /*
*/ avg_occupancy_rate byte combined_finance
206071028 "OAK PARK CONVALESCENT HOSPITAL" 351 63.71 0
206071028 "OAK PARK CONVALESCENT HOSPITAL" 1371 75.46 0
206071028 "" 1722 72.506448 1
end
form oshpd_fac_no %9.0f
list, noo
collapse (first) facility_name (lastnm) /*
*/ snf_medcare_days avg_occupancy_rate /*
*/ combined_finance, by(oshpd_fac_no)
list, noo
***********
HTH
Martin
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Matthew
Krauchunas
Sent: Montag, 5. Juli 2010 22:56
To: [email protected]
Subject: st: Replacing variable values after using collapse command
Hello,
I need advice on how to replace variable values. I have financial
data that contained more than 1 financial report in a single calendar
year. With much advice, I have been able to identify and combine
those periods using the collapse command. I then saved this file and
combined it with the master file via the append command. My problem
now though is how to combine the string information in the master
file with the values obtained after the collapse command. Here is an
abridged example:
oshpd_fac_no facility_name snf_medcare_days avg_occupancy_rate
combined_finance
206071028 OAK PARK CONVALESCENT HOSPITAL 351 63.71 0
206071028 OAK PARK CONVALESCENT HOSPITAL 1371 75.46 0
206071028 1722 72.506448 1
The oshpd_fac_no is the California assigned id number per PHYSICAL
address, the facility name is self-explanatory, snf_medcare_days &
avg_occupancy_rate were two of the variables collapsed respectively,
and combined_finance is an indicator variable created to show that
this observation was created via the collapse command. Now the crux
of the problem....I need to combine the string information from the
first two variables with the collapsed values in the third
observation. Thus, it should look like this when finished::
oshpd_fac_no facility_name snf_medcare_days avg_occupancy_rate
combined_finance
206071028 OAK PARK CONVALESCENT HOSPITAL 1722 72.506448 1
Any ideas?
Thank you for all the help thus far!
Matt
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/