<?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: Uninitialized Variables Troubleshooting in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Uninitialized-Variables-Troubleshooting/m-p/826877#M326618</link>
    <description>&lt;P&gt;Here's the log output (I used the sum function instead, as another person recommended in the comments):&amp;nbsp;&lt;/P&gt;&lt;P&gt;2805 DATA temp;&lt;BR /&gt;2806 set work.silver2;&lt;BR /&gt;2807 chronic_disease=.;&lt;BR /&gt;2808&lt;BR /&gt;2809 IF q2a_temp = 1 THEN _q2a_temp = 1;&lt;BR /&gt;2810 IF q2b_temp = 1 THEN _q2b_temp = 1;&lt;BR /&gt;2811 IF q2c_temp = 1 THEN _q2c_temp = 1;&lt;BR /&gt;2812 IF q2d_temp = 1 THEN _q2d_temp = 1;&lt;BR /&gt;2813 IF q2e_temp = 1 THEN _q2e_temp = 1;&lt;BR /&gt;2814 IF q2f_temp = 1 THEN _q2f_temp = 1;&lt;BR /&gt;2815 IF q2g_temp = 1 THEN _q2g_temp = 1;&lt;BR /&gt;2816 IF q2h_temp = 1 THEN _q2h_temp = 1;&lt;BR /&gt;2817 IF q2i_temp = 1 THEN _q2i_temp = 1;&lt;BR /&gt;2818 IF q2j_temp = 1 THEN _q2j_temp = 1;&lt;BR /&gt;2819 IF q2k_temp = 1 THEN _q2k_temp = 1;&lt;BR /&gt;2820 IF q2l_temp = 1 THEN _q2l_temp = 1;&lt;BR /&gt;2821 IF q2m_temp = 1 THEN _q2m_temp = 1;&lt;BR /&gt;2822 IF q2n_temp = 1 THEN _q2n_temp = 1;&lt;BR /&gt;2823&lt;BR /&gt;2824 SUMRACE=&lt;BR /&gt;2824! sum(_q2a_temp,_q2b_temp,_q2c_temp,_q2d_temp,_q2e_temp,_q2f_temp,_q2g_temp,_q2h_temp,_q2i_tem&lt;BR /&gt;2824! p,_q2j_temp,_q2k_temp,_q2l_temp,_q2m_temp,_q2n_temp);&lt;BR /&gt;2825 RUN;&lt;/P&gt;&lt;P&gt;NOTE: Variable q2a_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2b_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2c_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2d_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2e_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2f_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2g_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2h_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2i_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2j_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2k_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2l_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2m_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2n_temp is uninitialized.&lt;BR /&gt;NOTE: Missing values were generated as a result of performing an operation on missing values.&lt;BR /&gt;Each place is given by: (Number of times) at (Line):(Column).&lt;BR /&gt;596 at 2824:16&lt;BR /&gt;NOTE: There were 596 observations read from the data set WORK.SILVER2.&lt;BR /&gt;NOTE: The data set WORK.TEMP has 596 observations and 327 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.04 second&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I was cleaning up the variables before trying to do this sum, I was using the format:&amp;nbsp;&lt;/P&gt;&lt;P&gt;2702&lt;BR /&gt;2703 DATA temp;&lt;BR /&gt;2704 Set work.silver2;&lt;BR /&gt;2705 q2m_temp=.;&lt;BR /&gt;2706 IF (Q2m=1) then q2m_temp=0;&lt;BR /&gt;2707 IF (Q2m=2) then q2m_temp=1;&lt;BR /&gt;2708 IF (Q2m=98) then q2m_temp=98;&lt;BR /&gt;2709 IF (Q2m=99) then q2m_temp=99;&lt;BR /&gt;2710 IF (Q2m=901) then q2m_temp=901;&lt;BR /&gt;2711 LABEL q2m_temp="q2m_temp";&lt;BR /&gt;2712 RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That seemed to be working just fine and I was getting the output that I needed using the same recode format for all 14 variables.&amp;nbsp; The data set doesn't have missing variables, although once I get a sum formula that works, I will have to initialize the 98, 99 and 901 to missing before adding (I think).&amp;nbsp; I'm very new at this, so any advice is welcome&lt;/P&gt;</description>
    <pubDate>Wed, 03 Aug 2022 14:21:58 GMT</pubDate>
    <dc:creator>EmmaW</dc:creator>
    <dc:date>2022-08-03T14:21:58Z</dc:date>
    <item>
      <title>Uninitialized Variables Troubleshooting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Uninitialized-Variables-Troubleshooting/m-p/826755#M326556</link>
      <description>&lt;P&gt;I've been trying to perform a row sum for 14 variables in my data set.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's my code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA temp;&lt;BR /&gt;set work.silver2;&lt;BR /&gt;sum_chronic=q2a_temp + q2b_temp + q2c_temp + q2d_temp + q2e_temp + q2f_temp + q2g_temp + q2h_temp + q2i_temp + q2j_temp + q2k_temp + q2l_temp + q2m_temp + q2n_temp;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;Every time I run the data, it tells me that the variables are unintialized, but this is the same "data" line and "set" that I collapsed the variables into earlier.&amp;nbsp; Any advice for how to fix this? I'm very confused.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 00:05:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Uninitialized-Variables-Troubleshooting/m-p/826755#M326556</guid>
      <dc:creator>EmmaW</dc:creator>
      <dc:date>2022-08-03T00:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: Uninitialized Variables Troubleshooting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Uninitialized-Variables-Troubleshooting/m-p/826760#M326559</link>
      <description>&lt;P&gt;Please post your complete SAS log including all messages so we can see more clearly what is going on.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 00:54:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Uninitialized-Variables-Troubleshooting/m-p/826760#M326559</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-08-03T00:54:56Z</dc:date>
    </item>
    <item>
      <title>Re: Uninitialized Variables Troubleshooting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Uninitialized-Variables-Troubleshooting/m-p/826783#M326574</link>
      <description>&lt;P&gt;Show us the result of Proc Contents on the data set Work.silver2. Just need the section of the variable names and types.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hint: Unless your desired behavior is to have a missing value when any of the variables on that addition statement are missing I would suggest using the SUM function which will total the non-missing values. The + operator will return missing if ANY of the values is missing. Note that this means that if every observation has one or more missing values for the q2 _temp variables then Sum_chronic would be missing for every observation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't know who suggested naming variables q2a_temp q2b_temp etc. If those had been named Temp_q2a Temp_q2b etc. You might be able to use the list short cut of temp_q2:&amp;nbsp; to use all the variables whose names start with temp_q2 so that long statement could reduce to &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;sum_chronic = sum(of temp_q2:);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And the A, B, C etc suffixes might be better, at least in terms of SAS coding as 1, 2, 3 such as Temp_q2_1 Temp_q2_2 Temp_q2_3 because there are places where enumerated lists such at Temp_q2_3 - Temp_q2_10 to use the 3rd through 10th of the temp q2 variables might be handy. The character suffix doesn't play nice with sequences in names.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 05:00:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Uninitialized-Variables-Troubleshooting/m-p/826783#M326574</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-08-03T05:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: Uninitialized Variables Troubleshooting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Uninitialized-Variables-Troubleshooting/m-p/826877#M326618</link>
      <description>&lt;P&gt;Here's the log output (I used the sum function instead, as another person recommended in the comments):&amp;nbsp;&lt;/P&gt;&lt;P&gt;2805 DATA temp;&lt;BR /&gt;2806 set work.silver2;&lt;BR /&gt;2807 chronic_disease=.;&lt;BR /&gt;2808&lt;BR /&gt;2809 IF q2a_temp = 1 THEN _q2a_temp = 1;&lt;BR /&gt;2810 IF q2b_temp = 1 THEN _q2b_temp = 1;&lt;BR /&gt;2811 IF q2c_temp = 1 THEN _q2c_temp = 1;&lt;BR /&gt;2812 IF q2d_temp = 1 THEN _q2d_temp = 1;&lt;BR /&gt;2813 IF q2e_temp = 1 THEN _q2e_temp = 1;&lt;BR /&gt;2814 IF q2f_temp = 1 THEN _q2f_temp = 1;&lt;BR /&gt;2815 IF q2g_temp = 1 THEN _q2g_temp = 1;&lt;BR /&gt;2816 IF q2h_temp = 1 THEN _q2h_temp = 1;&lt;BR /&gt;2817 IF q2i_temp = 1 THEN _q2i_temp = 1;&lt;BR /&gt;2818 IF q2j_temp = 1 THEN _q2j_temp = 1;&lt;BR /&gt;2819 IF q2k_temp = 1 THEN _q2k_temp = 1;&lt;BR /&gt;2820 IF q2l_temp = 1 THEN _q2l_temp = 1;&lt;BR /&gt;2821 IF q2m_temp = 1 THEN _q2m_temp = 1;&lt;BR /&gt;2822 IF q2n_temp = 1 THEN _q2n_temp = 1;&lt;BR /&gt;2823&lt;BR /&gt;2824 SUMRACE=&lt;BR /&gt;2824! sum(_q2a_temp,_q2b_temp,_q2c_temp,_q2d_temp,_q2e_temp,_q2f_temp,_q2g_temp,_q2h_temp,_q2i_tem&lt;BR /&gt;2824! p,_q2j_temp,_q2k_temp,_q2l_temp,_q2m_temp,_q2n_temp);&lt;BR /&gt;2825 RUN;&lt;/P&gt;&lt;P&gt;NOTE: Variable q2a_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2b_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2c_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2d_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2e_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2f_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2g_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2h_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2i_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2j_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2k_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2l_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2m_temp is uninitialized.&lt;BR /&gt;NOTE: Variable q2n_temp is uninitialized.&lt;BR /&gt;NOTE: Missing values were generated as a result of performing an operation on missing values.&lt;BR /&gt;Each place is given by: (Number of times) at (Line):(Column).&lt;BR /&gt;596 at 2824:16&lt;BR /&gt;NOTE: There were 596 observations read from the data set WORK.SILVER2.&lt;BR /&gt;NOTE: The data set WORK.TEMP has 596 observations and 327 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.04 second&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I was cleaning up the variables before trying to do this sum, I was using the format:&amp;nbsp;&lt;/P&gt;&lt;P&gt;2702&lt;BR /&gt;2703 DATA temp;&lt;BR /&gt;2704 Set work.silver2;&lt;BR /&gt;2705 q2m_temp=.;&lt;BR /&gt;2706 IF (Q2m=1) then q2m_temp=0;&lt;BR /&gt;2707 IF (Q2m=2) then q2m_temp=1;&lt;BR /&gt;2708 IF (Q2m=98) then q2m_temp=98;&lt;BR /&gt;2709 IF (Q2m=99) then q2m_temp=99;&lt;BR /&gt;2710 IF (Q2m=901) then q2m_temp=901;&lt;BR /&gt;2711 LABEL q2m_temp="q2m_temp";&lt;BR /&gt;2712 RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That seemed to be working just fine and I was getting the output that I needed using the same recode format for all 14 variables.&amp;nbsp; The data set doesn't have missing variables, although once I get a sum formula that works, I will have to initialize the 98, 99 and 901 to missing before adding (I think).&amp;nbsp; I'm very new at this, so any advice is welcome&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 14:21:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Uninitialized-Variables-Troubleshooting/m-p/826877#M326618</guid>
      <dc:creator>EmmaW</dc:creator>
      <dc:date>2022-08-03T14:21:58Z</dc:date>
    </item>
    <item>
      <title>Re: Uninitialized Variables Troubleshooting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Uninitialized-Variables-Troubleshooting/m-p/826879#M326619</link>
      <description>&lt;P&gt;If it did not generate the uninitialized variable message before then something has changed.&lt;/P&gt;
&lt;P&gt;If the code did not change then the dataset SILVER2 has changed. It no longer has those variables.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 14:27:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Uninitialized-Variables-Troubleshooting/m-p/826879#M326619</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-08-03T14:27:20Z</dc:date>
    </item>
  </channel>
</rss>

