![]() I was dreaded to do it in data steps but following extremely tedious but intuitive approach did the job at the end of the day.īy census_year zip sex racecat agecat1 run ĭata cenpop1996 set cenpop2000 year=put(1996,4.) run ĭata cenpop1997 set cenpop2000 year=put(1997,4.) run ĭata cenpop1998 set cenpop2000 year=put(1998,4.) run ĭata cenpop1999 set cenpop2000 year=put(1999,4.) run ĭata cenpop2000 set cenpop2000 year=put(2000,4.) run ĭata cenpop2001 set cenpop2000 year=put(2001,4.) run ĭata cenpop2002 set cenpop2000 year=put(2002,4.) run ĭata cenpop2003 set cenpop2000 year=put(2003,4.) run ĭata cenpop2004 set cenpop2000 year=put(2004,4.) run ĭata cenpop2005 set cenpop2010 year=put(2005,4.) run ĭata cenpop2006 set cenpop2010 year=put(2006,4.) run ĭata cenpop2007 set cenpop2010 year=put(2007,4.) run ĭata cenpop2008 set cenpop2010 year=put(2008,4.) run ĭata cenpop2009 set cenpop2010 year=put(2009,4.) run ĭata cenpop2010 set cenpop2010 year=put(2010,4.) run ĭata cenpop2011 set cenpop2010 year=put(2011,4.) run ĭata cenpop2012 set cenpop2010 year=put(2012,4.) run ĭata cenpop2013 set cenpop2010 year=put(2013,4.Key Variable(s) to Merge with Input SAS Data Set Rows with missing values of cases would indicate that there was no case developed for the specific combinations of population by these categorical variables. In resulting want-data, I'd like to see cases from case-data assigned to the population estimates (pop values) with their corresponding combinations of zip, racecat, agecat1 and sex. ![]() Case data lacks some combinations of categorical variables that census has since it is possible that no case developed in given year with a certain combination of race and age group, especially because it is a rare cancer. Census year 2000 corresponds to 1997-2000 data and census 2010 correspond to 2010-2013 data in my case-data. Sorry, for ja lack of explanation.Ĭensus data (pop) has population estimates for the all possible levels of categorical values by zip, racecat, agecat1 and sex. Sometimes we get close but the further the actual problem gets from a limited motivating example the more likely the solution fails. Examples help to let us know when rules were applied correctly but examples do not provide the rules. I can make a lot of data sets saying "turn this into that" but not providing rules as soon as a single extra value gets incorporated the "solution" falls apart because rules were not provided. Perhaps the code that filtered out the other categories was a mistake.Īnother consideration might be to describe just what this is supposed to be doing in descriptive terms. Or perhaps discuss just how those sort of silly, at least to me from the census data I've worked with, single code years get created. So it is time to go back and show an actual example of real input and the expected output. This code apparently shows FOUR variables. Your request only showed ONE variable that had to be duplicated from not actually matching data. Plus an apparent demographic variable that only has one value in a year.Īnd you don't show any result or describe in any way why it "don't make sense". My thought on the original question was that the desired result was sketchy and not intuitively obvious why you wanted values that didn't match. Proc sort data=pop by racecat census_year ġĒ013Ē010đ000 result on my actual datasets don't make sense. Proc sort data=case by racecat census_year I will greatly appreciate your help to accomplish 'want' dataset. In actuality, I have more linkage variables, such as 5-digit ZIP-code, year, race, gender and age groups making a use proc sql by multiple variables challenging. But I couldn't achieve it by merge in data step as shown in demo below. Desired result 'want' has all levels of both datasets. I'm trying to merge the 'case' data to population estimates data 'pop' with 20 census by racecat and census years.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |