<?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: I get an error &amp;quot;Variable MALE is uninitialized.&amp;quot; in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/I-get-an-error-quot-Variable-MALE-is-uninitialized-quot/m-p/774691#M246246</link>
    <description>&lt;P&gt;When you refer to the value of a character variable, you have to put it in quotes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if sex='Male' then ......&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Other notes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Case is important.&amp;nbsp; This would fail:&amp;nbsp; if sex="MALE' then ......&lt;/LI&gt;
&lt;LI&gt;You probably typed in tabs as part of the data, instead of spaces.&amp;nbsp; If so, you would need to replace the tab characters with spaces.&amp;nbsp;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Tabs are OK in the programming statements, but not in the data.&lt;/P&gt;</description>
    <pubDate>Sat, 16 Oct 2021 20:10:42 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2021-10-16T20:10:42Z</dc:date>
    <item>
      <title>I get an error "Variable MALE is uninitialized."</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-get-an-error-quot-Variable-MALE-is-uninitialized-quot/m-p/774688#M246245</link>
      <description>&lt;P&gt;This is the problem I have.&lt;/P&gt;&lt;PRE&gt;Data data_0;&lt;BR /&gt;	Input sex$	race$;&lt;BR /&gt;	&lt;BR /&gt;cards;&lt;BR /&gt;Male 	White&lt;BR /&gt;Male 	Black&lt;BR /&gt;Male 	White&lt;BR /&gt;Male 	Black&lt;BR /&gt;Female	White&lt;BR /&gt;Female	Black&lt;BR /&gt;Female 	White&lt;BR /&gt;Female 	White&lt;BR /&gt;Female	.	 &lt;BR /&gt;Male	.	 &lt;BR /&gt;.  		White&lt;BR /&gt;.  		Black&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt; RUN;&lt;BR /&gt; &lt;BR /&gt; DATA DATA_0;&lt;BR /&gt; SET DATA_0;&lt;BR /&gt;&lt;BR /&gt; 	IF SEX = MALE AND RACE = WHITE THEN SEX_RACE = "MALE WHITE";&lt;BR /&gt;	ELSE IF sex = MALE AND RACE = BLACK THEN SEX_RACE = "MALE BLACK";&lt;BR /&gt;	ELSE IF sex = FeMALE AND RACE = BLACK THEN SEX_RACE = "FEMALE BLACK";&lt;BR /&gt;&lt;BR /&gt;	/*ELSE IF BMI &amp;gt;= 25 THEN BMI_CAT = "OVERWEIGHT";&lt;BR /&gt;	IF BMI = . THEN BMI_CAT = " "; */&lt;BR /&gt; RUN;&lt;/PRE&gt;&lt;PRE&gt;Data data_0;
	Input sex$	race$;
cards;
Male 	White
Male 	Black
Male 	White
Male 	Black
Female	White
Female	Black
Female 	White
Female 	White
Female	.	 
Male	.	 
.  		White
.  		Black
;

 RUN;
 
 DATA DATA_0;
 SET DATA_0;

 	IF SEX = MALE AND RACE = WHITE THEN SEX_RACE = "MALE WHITE";
	ELSE IF sex = MALE AND RACE = BLACK THEN SEX_RACE = "MALE BLACK";
	ELSE IF sex = FeMALE AND RACE = BLACK THEN SEX_RACE = "FEMALE BLACK";

 RUN;&lt;/PRE&gt;&lt;P&gt;I get the following error!&lt;/P&gt;&lt;PRE&gt; 
 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 68         
 69         Data data_0;
 70         Input sex$race$;
 71         
 72         cards;
 
 NOTE: SAS went to a new line when INPUT statement reached past the end of a line.
 NOTE: The data set WORK.DATA_0 has 10 observations and 2 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       user cpu time       0.00 seconds
       system cpu time     0.00 seconds
       memory              667.46k
       OS Memory           23460.00k
       Timestamp           10/16/2021 07:13:31 PM
       Step Count                        24  Switch Count  2
       Page Faults                       0
       Page Reclaims                     149
       Page Swaps                        0
       Voluntary Context Switches        10
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           264
       
 
 85         ;
 86         
 87          RUN;
 88         
 89          DATA DATA_0;
 90          SET DATA_0;
 91         
 92          IF SEX = MALE AND RACE = WHITE THEN SEX_RACE = "MALE WHITE";
 93         ELSE IF sex = MALE AND RACE = BLACK THEN SEX_RACE = "MALE BLACK";
 94         ELSE IF sex = FeMALE AND RACE = BLACK THEN SEX_RACE = "FEMALE BLACK";
 95         
 96         /*ELSE IF BMI &amp;gt;= 25 THEN BMI_CAT = "OVERWEIGHT";
 97         IF BMI = . THEN BMI_CAT = " "; */
 98          RUN;
 
 NOTE: Variable MALE is uninitialized.
 NOTE: Variable WHITE is uninitialized.
 NOTE: Variable BLACK is uninitialized.
 NOTE: Variable FeMALE is uninitialized.
 NOTE: There were 10 observations read from the data set WORK.DATA_0.
 NOTE: The data set WORK.DATA_0 has 10 observations and 7 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       user cpu time       0.00 seconds
       system cpu time     0.00 seconds
       memory              953.96k
       OS Memory           23976.00k
       Timestamp           10/16/2021 07:13:31 PM
       Step Count                        25  Switch Count  2
       Page Faults                       0
       Page Reclaims                     164
       Page Swaps                        0
       Voluntary Context Switches        11
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           264
       
 
 99         
 100        OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 110        &lt;/PRE&gt;&lt;P&gt;Can someone help me?&lt;/P&gt;</description>
      <pubDate>Sat, 16 Oct 2021 19:50:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-get-an-error-quot-Variable-MALE-is-uninitialized-quot/m-p/774688#M246245</guid>
      <dc:creator>PKV</dc:creator>
      <dc:date>2021-10-16T19:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: I get an error "Variable MALE is uninitialized."</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-get-an-error-quot-Variable-MALE-is-uninitialized-quot/m-p/774691#M246246</link>
      <description>&lt;P&gt;When you refer to the value of a character variable, you have to put it in quotes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if sex='Male' then ......&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Other notes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Case is important.&amp;nbsp; This would fail:&amp;nbsp; if sex="MALE' then ......&lt;/LI&gt;
&lt;LI&gt;You probably typed in tabs as part of the data, instead of spaces.&amp;nbsp; If so, you would need to replace the tab characters with spaces.&amp;nbsp;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Tabs are OK in the programming statements, but not in the data.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Oct 2021 20:10:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-get-an-error-quot-Variable-MALE-is-uninitialized-quot/m-p/774691#M246246</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-10-16T20:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: I get an error "Variable MALE is uninitialized."</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-get-an-error-quot-Variable-MALE-is-uninitialized-quot/m-p/774710#M246248</link>
      <description>&lt;P&gt;Tabs have nothing to do in a program imho. Spaces only belong in code.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Oct 2021 22:42:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-get-an-error-quot-Variable-MALE-is-uninitialized-quot/m-p/774710#M246248</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-10-17T22:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: I get an error "Variable MALE is uninitialized."</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-get-an-error-quot-Variable-MALE-is-uninitialized-quot/m-p/774723#M246252</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;My favorite depiction of this:&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;div class="video-embed-center video-embed"&gt;&lt;iframe class="embedly-embed" src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DSsoOG6ZeyUI&amp;amp;type=text%2Fhtml&amp;amp;schema=youtube&amp;amp;display_name=YouTube&amp;amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FSsoOG6ZeyUI" width="200" height="112" scrolling="no" title="YouTube embed" frameborder="0" allow="autoplay; fullscreen; encrypted-media; picture-in-picture;" allowfullscreen="true"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Oct 2021 13:58:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-get-an-error-quot-Variable-MALE-is-uninitialized-quot/m-p/774723#M246252</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2021-10-17T13:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: I get an error "Variable MALE is uninitialized."</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-get-an-error-quot-Variable-MALE-is-uninitialized-quot/m-p/774774#M246267</link>
      <description>&lt;P&gt;Lol&lt;/P&gt;
&lt;P&gt;Glad we are on the same page and sanity prevails! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Oct 2021 22:51:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-get-an-error-quot-Variable-MALE-is-uninitialized-quot/m-p/774774#M246267</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-10-17T22:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: I get an error "Variable MALE is uninitialized."</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-get-an-error-quot-Variable-MALE-is-uninitialized-quot/m-p/774782#M246271</link>
      <description>Thank you Astounding! you are right! I should have put all the values under inverted commas. Moreover, male and female, black and white should be in lower case as in the data.</description>
      <pubDate>Mon, 18 Oct 2021 01:47:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-get-an-error-quot-Variable-MALE-is-uninitialized-quot/m-p/774782#M246271</guid>
      <dc:creator>PKV</dc:creator>
      <dc:date>2021-10-18T01:47:49Z</dc:date>
    </item>
  </channel>
</rss>

