09-09-2015
EricaW
Calcite | Level 5
Member since
08-27-2015
- 6 Posts
- 1 Likes Given
- 0 Solutions
- 0 Likes Received
-
Latest posts by EricaW
Subject Views Posted 1951 09-09-2015 03:15 PM 2065 08-28-2015 04:04 PM 2065 08-28-2015 01:42 PM 2065 08-28-2015 11:39 AM 2065 08-27-2015 07:45 PM 2119 08-27-2015 03:39 PM -
Activity Feed for EricaW
- Posted Re: How to increment an age between two dates on SAS Programming. 09-09-2015 03:15 PM
- Posted Re: How to increment an age between two dates on SAS Programming. 08-28-2015 04:04 PM
- Posted Re: How to increment an age between two dates on SAS Programming. 08-28-2015 01:42 PM
- Posted Re: How to increment an age between two dates on SAS Programming. 08-28-2015 11:39 AM
- Liked Re: How to increment an age between two dates for ballardw. 08-27-2015 07:47 PM
- Posted Re: How to increment an age between two dates on SAS Programming. 08-27-2015 07:45 PM
- Posted How to increment an age between two dates on SAS Programming. 08-27-2015 03:39 PM
-
Posts I Liked
Subject Likes Author Latest Post 1
09-09-2015
03:15 PM
Hi Ballard, Thank you again for all of your help. I was able to use your code to get withing 0.X% of CDC's numbers and get the totals within +/- 5-10 people. The tweak to my data was that current breasteeding and ever breastfed did not have missing coded as 9, they were just blank, so I recoded the missing. Worked like a charm! Thanks for everything, Erica
... View more
08-28-2015
04:04 PM
Thank you again! I have been substringing the characters into separate mm, dd, and yy variables and then turning them into SAS dates like this: lstbrstfeddt_mo= substr(lstbrstfed_dt,1,2); lstbrstfeddt_dy= substr(lstbrstfed_dt,3,2); lstbrstfeddt_yr= substr(lstbrstfed_dt,5,4); dobrstfd = MDY(lstbrstfeddt_mo ,lstbrstfeddt_dy ,lstbrstfeddt_yr); which is a pretty silly, high effort way to do it, now that I think about it. I was being lazy about changing the import code and created more work for myself, I do believe. It made sense at the time, I suppose, but that can be said of most bad decisions
... View more
08-28-2015
01:42 PM
OK, it looks like what my import statement (some legacy code from an epi from long, long ago) calls intvistdt is what you call DOV since it is positions 20-27 (see below). Why on earth everything was done as characters I have no clue, but I am going to fix it when I am past the "DO THIS NOW!" crunch, Thank you so much for your help because I was seriously flying blind! data pednss_2_2012; infile 'G:\.....\XAZ_PedNSS_2012_Q02_20120925.dat' LRECL=400; input substate $3. clinic $9. zipcode $5. source_data $1. record_type $1. intvistdt $8. infantid $60. child_dob $8. gender $1. race $6. wic_race $3. contr_race $2. hholdsize $2. hholdmoincome $4. migrant $1. wic $1. foodstp $1. medicaid $1. tanf $1. bwtenglish $4. bwtmetric $4. htinch $3. htmetric $4. wtenglish $4. wtmetric $4. htwtmeas_dt $8. hgbin $3. hmct $3. hgbhmctmeas_dt $8. cur_brstfed $1. ever_brstfed $1. brstfed_length $2. lstbrstfed_dt $8. intro_suppl $2. tv $1. hshld_smokn $1.; run;
... View more
08-28-2015
11:39 AM
What I am running into is that there is no "Date of Visit" variable in this extract, or at least no date that is intuitive. Unfortunately our WIC program does not have a good handle on the data. All they know is that what they gave me is what they gave to CDC and they want me to make the same table. We do have initial visit date (which may actually be date of visit) and I suspect that when the quarterly files were merged only one visit was kept which is making this analysis more painful than necessary. Do you think appending the quarters for the 5 years (under the assumption that the kids have at least one record for each year) and then transposing "Initial visit" into Initial Visit1--Initial VisitN , then using the last visit that is within the year of reporting as a DOV in your code might work? As my extract stands, that is the only date that is not tied to a specific biometric measure (e.g. breastfeeding, height, weight)
... View more
08-27-2015
07:45 PM
Hi BallardW, You got it in one! It is PedNSS and, looking at your code, I probably would not have figured this out on my own....or at least not any time soon, so thank you. Just for my own understanding, what you are doing is adding days in your array to confirm that someone is in the denominator and, if they are, classifying them as breastfed or not breastfed? And once they stop being breastfed they drop out of the numerator, into the denominator and continue along until the age out (in my case at age 5)? Thank you again! Erica
... View more
08-27-2015
03:39 PM
Hi all I am bumping into a coding issue that has me stumped. I have 5 years of data for a children under 5 and I need to find for each year the number that turned specific ages who breastfed for specific time periods in a year. For example, I need to calculate all of the children who turned 1+ weeks old in the year who breastfed for more than one week, children who turned 2+ weeks old in the year who breastfed for more than two weeks, etc. I have child DOB, date last asked about breastfeeding and whether they ever breastfed. I have sorted out how ages at the beginning and end of the time period and age at time of breastfeeding question but I keep ending up with too many kids in each age group, probably because I am pulling in everyone who was 1+weeks, 2+weeks, etc. old, rather than just those who turned that age during the time period. I am stumped on how to get only the kids that turned that age in the year, especially since kids pass from one age group to the next through out the year. So your 1 week olds become 2 weeks, become 3 weeks....up to 18 months. Any help would be greatly appreciated! A portion of my code is below Thanks, Erica data BFDuration; set perm.dataset; IF AGEMOS<60 AND AGEMOS NE .; %LET YR=YEAR; Startperiod = MDY(1,1,&yr); Endperiod = MDY(12,31,&yr); *****Child birthday******; child_dobmo= substr(child_dob,1,2); child_dobdy= substr(child_dob,3,2); child_dobyr= substr(child_dob,5,4); ChildDOB = MDY(child_dobmo, child_dobdy, child_dobyr); *********Last breastfeeding response***** lstbrstfeddt_mo= substr(lstbrstfed_dt,1,2); lstbrstfeddt_dy= substr(lstbrstfed_dt,3,2); lstbrstfeddt_yr= substr(lstbrstfed_dt,5,4); DOBreastfed = MDY(lstbrstfeddt_mo ,lstbrstfeddt_dy ,lstbrstfeddt_yr); *****Age at last breastfeeding response in weeks and months**** BFAGEwk=INTCK('WEEK',CHILDDOB,DOBREASTFED); BFAGEmo=INTCK('MONTH',CHILDDOB,DOBREASTFED); ****Currently or ever breastfed***** if cur_brstfed='1' or ever_brstfed='1' then brstfed='1'; if cur_brstfed='2' and ever_brstfed='2' then brstfed='2'; if cur_brstfed~='' and ever_brstfed='' then brstfed=cur_brstfed; if cur_brstfed='' and ever_brstfed~='' then brstfed=ever_brstfed; *****Age at beginning and end of time period***** if childdob<= MDY(1,1,&yr) then DO; AGESTARTwk=intck('WEEK',childdob,Startperiod); AGESTARTmo=intck('MONTH',childdob,Startperiod); AGEENDwk=intck('WEEK',childdob,Endperiod); AGEENDmo=intck('MONTH',childdob,Endperiod) END; if childdob> MDY(1,1,&yr)then DO; AGEENDwk=intck('WEEK',childdob,Endperiod); AGEENDmo=intck('MONTH',childdob,Endperiod); END; IF AGESTARTwk<=1 AND AGESTARTwk NE . AND brstfed=1 THEN DO; IF BFAGEwk>=1 THEN BF1WK=1; IF BFAGEwk<=1 THEN BF1WK=0; END; IF AGEENDwk>1 AND AGEENDWK NE . AND brstfed=1 THEN DO; WEEK1=INTCK('WEEK',CHILDDOB,DOBreastfed); IF BFAGEwk>=1 THEN BF1WK=1; IF BFAGEwk<=1 THEN BF1WK=0; END; IF brstfed=2 THEN DO; BF1WK=0; END;
... View more