LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 2010, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 27 Apr 2010 13:20:04 -0400
Reply-To:     Michael Raithel <michaelraithel@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Michael Raithel <michaelraithel@WESTAT.COM>
Subject:      Re: Help with SAS codes
In-Reply-To:  <5E72C3185B4B614898BAA404B56C3A8703275E78@EXCHVS53.mx.state.mo.us>
Content-Type: text/plain; charset="us-ascii"

Dear SAS-L-ers,

Arthur Pashi posted the long, interesting message listed after my Sig line.

Arthur, just a quick heads-up after a perusal of your SAS program. You should also code for the condition where the respondent/data preparer entered a value of PAINA that is not in your spiffy list of 01 - 11, 77, and 99. E.g. what if PAINA is 27 or 55 or -1?!?!?! I would code for the possibility of unexpected values.

If there is one thing that one learns from dealing with data collected in the field, it is not to trust that variable values always neatly fall into the values specified in a codebook. So, engage in safe SAS; even if you think you know where the data set has been:-)

Arthur, best of luck in all your SAS endeavors!

I hope that this suggestion proves helpful now, and in the future!

Of course, all of these opinions and insights are my own, and do not reflect those of my organization or my associates. All SAS code and/or methodologies specified in this posting are for illustrative purposes only and no warranty is stated or implied as to their accuracy or applicability. People deciding to use information in this posting do so at their own risk.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Michael A. Raithel "The man who wrote the book on performance" E-mail: MichaelRaithel@westat.com

Author: Tuning SAS Applications in the MVS Environment

Author: Tuning SAS Applications in the OS/390 and z/OS Environments, Second Edition http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=58172

Author: The Complete Guide to SAS Indexes http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=60409

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Trust but verify. - Ronald Reagan +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

> -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of > Pashi, Arthur > Sent: Tuesday, April 27, 2010 12:50 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Help with SAS codes > > I am analyzing the following survey question: > > What did the healthcare professional say was causing your pain? > > > > Do not read (check all that apply) > > 01 Accident injury > > 02 Arthritis (include osteoarthritis, > rheumatoid arthritis, tendonitis, bursitis) > > 03 Cancer > > 04 Dental/oral condition > > 05 Diabetes > > 06 Muscle pain > > 07 Neuropathic pain > > 08 Sciatica/slipped disc/spondylosis > > 09 Shingles > > 10 Other (specify) > > > 11 Doctor didn't say/doctor didn't know > > 77 Don't know/Not sure > > 99 Refused > > Responses to the main question were grouped into two categories: > Question 1a and question 1b. later > > > > * Variable paina - What did the healthcare professional say was causing > your pain?; > > > > Expected responses were coded either 1, 2, ....or 11 (variable paina). > Responses from (10) Other (specify) were also obtained and grouped > under > variable painb following the same pattern of responses as those from 1, > 2 through 11. Those other responses that did not correspond to > responses of the series 1 to 11 were assigned to 12, 13, through 28 > (question 1b below). > > > > DATA SASDATA; > > INPUT ............; > > > > if paina = 1 then paina1 = 1; > > else if paina >= 2 and paina <= 11 then painb1 = 0; > > *else if paina in (2,3,4,5,6,7,8,9,10,11) then paina1 = 0; > > else if paina in (.,77,99) then paina1 = .; > > label paina1 = 'Accident injury'; > > > > * Variable painb - (from Other-specify or What else did the healthcare > professional say was causing your pain?); > > > > if painb = 1 then painb1 = 1; > > else if painb >= 2 and painb <= 28) then painb1 = 0; > > else if painb in (.,77,99) then painb1 = .; > > label painb1 = 'Other accident injuries'; > > > > *else if painb in > (2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27, > 2 > 8) then painb1 = 0; * the numbers in that else if painb represent > causes > of pain; > > > > *Aggregate response 1 of question 1a with response 1 of question 1b > category (i.e. accident injury); > > > > if paina1 = 1 or painb1 = 1 then pain1tot = 1; > > else if paina1 in (.,77,99) or painb1 in (.,77,99) then pain1tot = .; > > else pain1tot = 0; > > label pain1tot = 'All accident injuries'; > > > > Any comments on how to obtain "All accident injuries"? Your input is > valued. > > > > Thank you, > > > > Arthur Pashi > >


Back to: Top of message | Previous page | Main SAS-L page