<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SAS reading rows/combining categorical variables in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-reading-rows-combining-categorical-variables/m-p/749716#M36458</link>
    <description>&lt;P&gt;You would need the names of the SAS data set variables. I'm fairly sure they aren't actually 500hz.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The MAX function will report the largest non-missing value of a list of variables. In a data step very generic code would look like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; maxvalue = max(var1, var2, var3);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the names are nice you may be able to use a list such as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; maxvalue = max( of reading1 - reading14);&lt;/P&gt;
&lt;P&gt;if the variable names are sequentially numbered. Or if the columns are adjacent columns in the data set&lt;/P&gt;
&lt;P&gt;&amp;nbsp; maxvalue = max(of firstreading -- lastreading);&amp;nbsp; &amp;lt;= note the two dashes together.&lt;/P&gt;
&lt;P&gt;or just list the variable names of interest.&lt;/P&gt;</description>
    <pubDate>Tue, 22 Jun 2021 20:35:06 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-06-22T20:35:06Z</dc:date>
    <item>
      <title>SAS reading rows/combining categorical variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-reading-rows-combining-categorical-variables/m-p/749712#M36456</link>
      <description>&lt;P&gt;We are interested in using data from the National Health and Nutrition Examination Survey (NHANES) to establish the prevalence of hearing loss among subjects who participated in the audiology portion of the survey.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;The subject data are organized in rows. &lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;The threshold for hearing (db) for each of 14 sound frequencies in both ears are provided in their databases (14 columns).&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;We are categorizing hearing impairment by the highest threshold (db) at any of those 14 sound frequencies.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Can anybody describe the code necessary to determine what the highest threshold would be?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;ID#&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;500hz&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;1000hz&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;2000hz&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;3000hz&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;4000hz&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;5000hz&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;6000hz&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;123&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;0&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;0&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;10&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;20&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;0&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;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&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;478&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 20:25:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-reading-rows-combining-categorical-variables/m-p/749712#M36456</guid>
      <dc:creator>AnnaRombakh</dc:creator>
      <dc:date>2021-06-22T20:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: SAS reading rows/combining categorical variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-reading-rows-combining-categorical-variables/m-p/749713#M36457</link>
      <description>Given the input shown, what do you want as output?</description>
      <pubDate>Tue, 22 Jun 2021 20:26:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-reading-rows-combining-categorical-variables/m-p/749713#M36457</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-06-22T20:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: SAS reading rows/combining categorical variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-reading-rows-combining-categorical-variables/m-p/749716#M36458</link>
      <description>&lt;P&gt;You would need the names of the SAS data set variables. I'm fairly sure they aren't actually 500hz.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The MAX function will report the largest non-missing value of a list of variables. In a data step very generic code would look like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; maxvalue = max(var1, var2, var3);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the names are nice you may be able to use a list such as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; maxvalue = max( of reading1 - reading14);&lt;/P&gt;
&lt;P&gt;if the variable names are sequentially numbered. Or if the columns are adjacent columns in the data set&lt;/P&gt;
&lt;P&gt;&amp;nbsp; maxvalue = max(of firstreading -- lastreading);&amp;nbsp; &amp;lt;= note the two dashes together.&lt;/P&gt;
&lt;P&gt;or just list the variable names of interest.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 20:35:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-reading-rows-combining-categorical-variables/m-p/749716#M36458</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-06-22T20:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: SAS reading rows/combining categorical variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-reading-rows-combining-categorical-variables/m-p/749722#M36460</link>
      <description>&lt;P&gt;To better elaborate my question, I am trying to get SAS to read all of my variables 500, 1000, 2000, 3000, 4000, 6000, 8000 hz and categorize them by degree of hearing loss. The classification of hearing loss for my study is the same for all frequencies ex. -10-15 db is normal, 16-24db is slight hearing loss, etc. and I would like SAS to analyze all variables and categorize them by their degree of hearing loss. This is why I would like them to be read in rows, so that my output produces individuals in categories of hearing loss. Because I have 14 variables, I am confused on how to do this.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 20:56:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-reading-rows-combining-categorical-variables/m-p/749722#M36460</guid>
      <dc:creator>AnnaRombakh</dc:creator>
      <dc:date>2021-06-22T20:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: SAS reading rows/combining categorical variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-reading-rows-combining-categorical-variables/m-p/749728#M36462</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/386979"&gt;@AnnaRombakh&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;To better elaborate my question, I am trying to get SAS to read all of my variables 500, 1000, 2000, 3000, 4000, 6000, 8000 hz and categorize them by degree of hearing loss. The classification of hearing loss for my study is the same for all frequencies ex. -10-15 db is normal, 16-24db is slight hearing loss, etc. and I would like SAS to analyze all variables and categorize them by their degree of hearing loss. This is why I would like them to be read in rows, so that my output produces individuals in categories of hearing loss. Because I have 14 variables, I am confused on how to do this.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What are the rules for categorizing? What type of analysis?&lt;/P&gt;
&lt;P&gt;One approach when you need to make categories from more-or-less continuous values is to create a FORMAT.&lt;/P&gt;
&lt;P&gt;Which might look something like:&lt;/P&gt;
&lt;PRE&gt;Proc format;
value hearloss
0 - &amp;lt;10 ="Minimal"
10 -&amp;lt;16 ="Normal"
16 -&amp;lt;24 ="Slight"
24 - &amp;lt; ??="some description"
/*repeat as needed for desired ranges*/
;&lt;/PRE&gt;
&lt;P&gt;Applying this format to a variable would create a group that is honored for procedures that use categorical values for analysis (or graphing or reporting).&lt;/P&gt;
&lt;P&gt;But not being in the industry I have no idea how to combine 14 variables into a single "score" if that is what you want. If you have rules we can likely help implement them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you can't show us what you expect a data set to look like we can't help you make it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc Transpose is a typical tool for making a data set long. One thing that would make this tricky is the NHANES weighting scheme. Making data "long" or "by rows" would tend to duplicate the weighting variable which means the weight would be applied incorrectly for almost any analysis.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 21:35:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-reading-rows-combining-categorical-variables/m-p/749728#M36462</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-06-22T21:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: SAS reading rows/combining categorical variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-reading-rows-combining-categorical-variables/m-p/749741#M36464</link>
      <description>I apologize if my questions are confusing or lacking context. Eventually, I will be doing a multiple logistic regression with my data set. I have completed the proc format already for my SAS code, but because I am unable to get SAS to read each variable and classify it in a categorical variable (normal, slight, etc), I am unable to do my descriptive statistics. My thesis is analyzing the relationship between non-HDL-C (total cholesterol, high-density lipoprotein cholesterol/HDL) and degree of hearing loss and would like to be able to have a descriptive table that allows me to see how many individuals of elevated non-HDL-C have hearing loss.</description>
      <pubDate>Tue, 22 Jun 2021 22:12:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-reading-rows-combining-categorical-variables/m-p/749741#M36464</guid>
      <dc:creator>AnnaRombakh</dc:creator>
      <dc:date>2021-06-22T22:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: SAS reading rows/combining categorical variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-reading-rows-combining-categorical-variables/m-p/749744#M36465</link>
      <description>Let's back up a 1000 steps. Have you imported the NHANES data correctly into SAS first? You have a SAS dataset somewhere with the data? The NHANES data is public so you can easily share that data set as well and any code.</description>
      <pubDate>Tue, 22 Jun 2021 22:21:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-reading-rows-combining-categorical-variables/m-p/749744#M36465</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-06-22T22:21:46Z</dc:date>
    </item>
    <item>
      <title>Re: SAS reading rows/combining categorical variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-reading-rows-combining-categorical-variables/m-p/749745#M36466</link>
      <description>&lt;P&gt;Apply a format such as shown to the variables.&lt;/P&gt;
&lt;P&gt;Should work.&lt;/P&gt;
&lt;P&gt;You do not need to "read them" as shown, though a custom INFORMAT would do that. One reason to stick with the values as current is suppose you see a "borderline" value issue and want to investigate if the model behaves differently with 10-14 and 15 to 24 instead of 10-15 and 16 to 24(are these actually integer values?).&lt;/P&gt;
&lt;P&gt;A different FORMAT would allow you to do that new model by changing ONE word: the format associated with the variables. If you actually create text values you would have to go back to an earlier step, create new text values, change the name of the data set to the one with the new values. Wash , rinse. repeat.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example that you should be able to run:&lt;/P&gt;
&lt;PRE&gt;proc format;
value agea
10-14 = '10-14'
15-19 = '15-19'
;
value ageb
10-12= '10 to 12'
13-15= '13 to 15'
16-high= '16+'
;
run;

proc freq data=sashelp.class;
   tables age;
   format age agea.;
run;
proc freq data=sashelp.class;
   tables age;
   format age ageb.;
run;&lt;/PRE&gt;
&lt;P&gt;The format could be used with Proc Logistic or Surveylogistic with CLASS variables to create the "categories".&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 22:23:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-reading-rows-combining-categorical-variables/m-p/749745#M36466</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-06-22T22:23:10Z</dc:date>
    </item>
  </channel>
</rss>

