<?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: PROC FORMAT when importing data from excel in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-FORMAT-when-importing-data-from-excel/m-p/474303#M285911</link>
    <description>&lt;P&gt;First thing is if you want to see the formatted values you have to apply the format to appropriate variable. You didn't mention any variable name but it might look something like&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;print&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;data&lt;/SPAN&gt;=project3;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; format cancertype $cancertypef.&amp;nbsp; institute $institute. ;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;Second is that the format TYPE has to match the variable. If the variable(s) you attempt to use the $cancertypef. format with are numeric then you will get an error about format type not matching the variable type. The $ on the value statement tells SAS the variable with contain character data.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;"Isn't working" is awful vague.&lt;BR /&gt;&lt;BR /&gt;Are there errors in the log?: Post the code and log in a code box opened with the {i} to maintain formatting of error messages.&lt;BR /&gt;&lt;BR /&gt;No output? Post any log in a code box.&lt;BR /&gt;&lt;BR /&gt;Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat&lt;/A&gt;... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Jun 2018 23:14:36 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-06-28T23:14:36Z</dc:date>
    <item>
      <title>PROC FORMAT when importing data from excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-FORMAT-when-importing-data-from-excel/m-p/474300#M285910</link>
      <description>&lt;P&gt;I am working on an assignment and I need to import an excel file into SAS and then randomly select different variables.&amp;nbsp;I have tried using proc format to code the variables but it isn's working..&amp;nbsp;This is the code&amp;nbsp;I currently have:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;options nodate nonumber&lt;SPAN&gt;;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;libname&lt;/SPAN&gt;&lt;SPAN&gt; computerapps &lt;/SPAN&gt;"C:\Users\efwalters\Documents\computerapps"&lt;SPAN&gt;;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;import&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;out&lt;/SPAN&gt;=Project3&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;datafile&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;"C:\Users\efwalters\Documents\computerapps\Project3.xlsx"&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;dbms&lt;/SPAN&gt;=xlsx replace;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;getnames&lt;/SPAN&gt;=yes;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;format&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;value&lt;/SPAN&gt;&lt;SPAN&gt; $institutef &lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;'Cancer Institute 1'&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;'Cancer Institute 2'&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;'Cancer Institute 3'&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;4&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;'Cancer Institute 4'&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;5&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;'Cancer Institute 5'&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;value&lt;/SPAN&gt;&lt;SPAN&gt; $cancertypef &lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;'Acute Lymphocytic Leukemia (ALL)'&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;'Acute Myeloid Leukemia (AML)'&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;'Chronic Lymphocutic Leukemia (CLL)'&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;4&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;'Chronic Myeloid Leukemia (CML)'&lt;SPAN&gt;;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;print&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;data&lt;/SPAN&gt;=project3;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 23:04:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-FORMAT-when-importing-data-from-excel/m-p/474300#M285910</guid>
      <dc:creator>efwalters</dc:creator>
      <dc:date>2018-06-28T23:04:52Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FORMAT when importing data from excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-FORMAT-when-importing-data-from-excel/m-p/474303#M285911</link>
      <description>&lt;P&gt;First thing is if you want to see the formatted values you have to apply the format to appropriate variable. You didn't mention any variable name but it might look something like&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;print&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;data&lt;/SPAN&gt;=project3;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; format cancertype $cancertypef.&amp;nbsp; institute $institute. ;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;Second is that the format TYPE has to match the variable. If the variable(s) you attempt to use the $cancertypef. format with are numeric then you will get an error about format type not matching the variable type. The $ on the value statement tells SAS the variable with contain character data.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;"Isn't working" is awful vague.&lt;BR /&gt;&lt;BR /&gt;Are there errors in the log?: Post the code and log in a code box opened with the {i} to maintain formatting of error messages.&lt;BR /&gt;&lt;BR /&gt;No output? Post any log in a code box.&lt;BR /&gt;&lt;BR /&gt;Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat&lt;/A&gt;... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 23:14:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-FORMAT-when-importing-data-from-excel/m-p/474303#M285911</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-06-28T23:14:36Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FORMAT when importing data from excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-FORMAT-when-importing-data-from-excel/m-p/474321#M285912</link>
      <description>&lt;P&gt;Thank you for you input!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to add in what you included, but my output still includes the original values not the numeric values that I wrote into the proc format code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No errors or warnings popup in the log window...&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jun 2018 01:42:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-FORMAT-when-importing-data-from-excel/m-p/474321#M285912</guid>
      <dc:creator>efwalters</dc:creator>
      <dc:date>2018-06-29T01:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FORMAT when importing data from excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-FORMAT-when-importing-data-from-excel/m-p/474325#M285913</link>
      <description>Post your full code and log. &lt;BR /&gt;Also, did you verify the types aligned as indicated in BallardW's post?</description>
      <pubDate>Fri, 29 Jun 2018 01:45:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-FORMAT-when-importing-data-from-excel/m-p/474325#M285913</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-29T01:45:19Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FORMAT when importing data from excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-FORMAT-when-importing-data-from-excel/m-p/474469#M285914</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/218343"&gt;@efwalters&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you for you input!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried to add in what you included, but my output still includes the original values not the numeric values that I wrote into the proc format code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No errors or warnings popup in the log window...&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Actual data is important when comes to format. The values have to actually correspond to what is in the dataset.&lt;/P&gt;
&lt;PRE&gt;data example;
   code = ' 1';
run;

proc print data=example;
   format code $institutef.;
run;&lt;/PRE&gt;
&lt;P&gt;Shows 1 in the output for code because the actual value has a leading space. That does not match the definition of the format which does not allow for leading spaces the way you have defined it. The format would work for a value of '1 ' because the value for string comparisons matches.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jun 2018 15:19:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-FORMAT-when-importing-data-from-excel/m-p/474469#M285914</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-06-29T15:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FORMAT when importing data from excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-FORMAT-when-importing-data-from-excel/m-p/474668#M285915</link>
      <description>&lt;P&gt;I was able to format the variables the way I was hoping, but now I am having an issue with using the "IF statement"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code I currently have:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;options nodate nonumber&lt;SPAN&gt;;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;format&lt;/STRONG&gt;&lt;SPAN&gt;; &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;value&lt;/SPAN&gt;&lt;SPAN&gt; $institutef &lt;/SPAN&gt;'Cancer Institute 1'&lt;SPAN&gt; = &lt;/SPAN&gt;'CI1'&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;'Cancer Institute 2'&lt;SPAN&gt; = &lt;/SPAN&gt;'CI2'&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;'Cancer Institute 3'&lt;SPAN&gt; = &lt;/SPAN&gt;'CI3'&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;'Cancer Institute 4'&lt;SPAN&gt; = &lt;/SPAN&gt;'CI4'&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;'Cancer Institute 5'&lt;SPAN&gt; = &lt;/SPAN&gt;'CI5'&lt;SPAN&gt;;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;value&lt;/SPAN&gt;&lt;SPAN&gt; $cancertypef &lt;/SPAN&gt;'Acute Lymphocytic Leukemia (ALL)'&lt;SPAN&gt; = &lt;/SPAN&gt;'ALL'&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;'Acute Myeloid Leukemia (AML)'&lt;SPAN&gt; = &lt;/SPAN&gt;'AML'&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;'Chronic Lymphocutic Leukemia (CLL)'&lt;SPAN&gt; = &lt;/SPAN&gt;'CLL'&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;'Chronic Myeloid Leukemia (CML)'&lt;SPAN&gt; = &lt;/SPAN&gt;'CML'&lt;SPAN&gt;; &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;import&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;out&lt;/SPAN&gt;=Project3 &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;datafile&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;"C:\Users\efwalters\Documents\computerapps\Project3.xlsx"&lt;SPAN&gt; &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;dbms&lt;/SPAN&gt;=xlsx replace; &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;getnames&lt;/SPAN&gt;=yes; &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;; &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt; project3;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;set&lt;/SPAN&gt; project3;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;format&lt;/SPAN&gt;&lt;SPAN&gt; leu_type &lt;/SPAN&gt;$cancertypef.&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;inst_num &lt;/SPAN&gt;$institutef.&lt;SPAN&gt;;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt; tempp;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;set&lt;/SPAN&gt; project3;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if&lt;/SPAN&gt; inst_num = CI1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt; temp1;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;set&lt;/SPAN&gt; tempp;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if&lt;/SPAN&gt; leu_type = ALL;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;x = ranuni(&lt;SPAN&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/SPAN&gt;);&lt;/P&gt;&lt;P&gt;output&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;sort&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;data&lt;/SPAN&gt;=temp1;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;by&lt;/SPAN&gt; x;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt; one;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;set&lt;/SPAN&gt; temp1 (obs=&lt;SPAN&gt;&lt;STRONG&gt;5&lt;/STRONG&gt;&lt;/SPAN&gt;);&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;print&lt;/STRONG&gt; &lt;SPAN&gt;data&lt;/SPAN&gt;&lt;SPAN&gt;=one;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;And in the log window, this note appears: "&lt;/SPAN&gt;NOTE: Variable CI1 is uninitialized."&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jun 2018 13:57:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-FORMAT-when-importing-data-from-excel/m-p/474668#M285915</guid>
      <dc:creator>efwalters</dc:creator>
      <dc:date>2018-06-30T13:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FORMAT when importing data from excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-FORMAT-when-importing-data-from-excel/m-p/474671#M285916</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;And in the log window, this note appears: "&lt;/SPAN&gt;&lt;SPAN&gt;NOTE: Variable CI1 is uninitialized."&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;That error message is very clear.&amp;nbsp; In this block of code:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data tempp; 
set project3; 
if inst_num = CI1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;You are testing if the variable INST_NUM is equal to the variable CI1.&amp;nbsp; SAS is saying that there is no variable named CI1.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;From the rest of your program it looks like you probably wanted to test if the formatted value of INST_NUM was equal to the string literal 'CI1'.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if put(inst_num,$institutef.)='CI1';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jun 2018 14:18:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-FORMAT-when-importing-data-from-excel/m-p/474671#M285916</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-06-30T14:18:16Z</dc:date>
    </item>
  </channel>
</rss>

