<?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: Variable is uninitialized in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Variable-is-uninitialized/m-p/497196#M6250</link>
    <description>&lt;P&gt;Welcome to the wonderful world of relying on guessing. Proc Import has to guess as to variable information. Depending on how consistent whoever creates those Excel files the column headings may change slightly which means that the variable names change. As well as the data types. Note that the paths are different in the Proc Import steps. Are they supposed to be to the same Excel file or two different ones with the same name. If the later then the content issues come into play.&lt;/P&gt;
&lt;P&gt;proc import datafile="/folders/myfolders//ABC-P WEEKLY CLAIMS REPORT.XLSX"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;FONT color="#ff0000"&gt;^second / not in below&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;proc import datafile="/folders/myfolders/ABC-P WEEKLY CLOSED CLAIMS REPORT.XLSX"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect that if you rerun the import for that set again and run proc contents on the set or investigate the variables with other tools that you will find those variables mentions as "uninitialized" do not exist in the data. Possibly something with similar spelling is there but computer programs are picky.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Because you used the construct:&lt;/P&gt;
&lt;P&gt;Data work.abc2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set work.abc2;&lt;/P&gt;
&lt;P&gt;you have replaced your initial data set and cannot verify that the import included the problem variables, though likely they appear far to the right of the data next to the variables you were attempting to calculate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Sep 2018 23:06:58 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-09-19T23:06:58Z</dc:date>
    <item>
      <title>Variable is uninitialized</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Variable-is-uninitialized/m-p/497173#M6248</link>
      <description>&lt;P&gt;I am trying to import data into the SAS University Edition with the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc import datafile="/folders/myfolders//ABC-P WEEKLY CLAIMS REPORT.XLSX"&lt;BR /&gt;OUT=WORK.ABC1&lt;BR /&gt;DBMS=xlsx&lt;BR /&gt;Replace;&lt;BR /&gt;options MSGLEVEL=I;&lt;BR /&gt;*range="Sheet1$";&lt;BR /&gt;*Getnames=yes;&lt;BR /&gt;*Mixed=yes;&lt;BR /&gt;*Scantext=yes;&lt;BR /&gt;*Usedate=yes;&lt;BR /&gt;*Scantime=yes;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;options validvarname=any;&lt;BR /&gt;data work.abc1;&lt;BR /&gt;set work.abc1;&lt;BR /&gt;indemnityPDPaid = input(indemnity_PD_paid, dollar12.0);&lt;BR /&gt;MedicalBIPaid=input(medical_BI_paid, dollar12.0);&lt;BR /&gt;format indemnityPDpaid MedicalBIPaid Total_outstanding net_incurred dollar12.0;&lt;BR /&gt;drop indemnity_PD_Paid Medical_BI_Paid;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc import datafile="/folders/myfolders/ABC-P WEEKLY CLOSED CLAIMS REPORT.XLSX"&lt;BR /&gt;OUT=WORK.ABC2&lt;BR /&gt;DBMS=xlsx&lt;BR /&gt;Replace;&lt;BR /&gt;options MSGLEVEL=I;&lt;BR /&gt;*range="Sheet1$";&lt;BR /&gt;*Getnames=yes;&lt;BR /&gt;*Mixed=yes;&lt;BR /&gt;*Scantext=yes;&lt;BR /&gt;*Usedate=yes;&lt;BR /&gt;*Scantime=yes;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;options validvarname=any;&lt;BR /&gt;data work.abc2;&lt;BR /&gt;set work.abc2;&lt;BR /&gt;indemnityPDPaid = input(indemnity_PD_paid, dollar12.0);&lt;BR /&gt;MedicalBIPaid=input(medical_BI_paid, dollar12.0);&lt;BR /&gt;format indemnityPDpaid MedicalBIPaid net_incurred dollar12.0;&lt;BR /&gt;drop indemnity_PD_Paid Medical_BI_Paid;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see the two sets of codes are almost identical.&amp;nbsp; However, although I have no problem getting the "&lt;SPAN&gt;indemnityPDPaid" and "&lt;/SPAN&gt;&lt;SPAN&gt;MedicalBIPaid" in the first dataset, i.e., work.abc1, I got error messages telling me that&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;Variable indemnity_PD_paid is uninitialized&lt;/EM&gt; and &lt;EM&gt;Variable medical_BI_paid is uninitialized&lt;/EM&gt;.&amp;nbsp; Any clue?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help.&amp;nbsp; Thanks.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Sep 2018 22:20:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Variable-is-uninitialized/m-p/497173#M6248</guid>
      <dc:creator>docctong</dc:creator>
      <dc:date>2018-09-19T22:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: Variable is uninitialized</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Variable-is-uninitialized/m-p/497195#M6249</link>
      <description>&lt;P&gt;We don't have your data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But nevertheless, when you get the message that the variable is uninitialized, you need to look at your data with your own eyeballs, using PROC PRINT or viewtable, or any other way to display the data its. When you look at work.abc1 and work.abc2 AFTER PROC IMPORT (not after the DATA step) in this manner, the problem will be obvious.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Sep 2018 23:08:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Variable-is-uninitialized/m-p/497195#M6249</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-09-19T23:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: Variable is uninitialized</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Variable-is-uninitialized/m-p/497196#M6250</link>
      <description>&lt;P&gt;Welcome to the wonderful world of relying on guessing. Proc Import has to guess as to variable information. Depending on how consistent whoever creates those Excel files the column headings may change slightly which means that the variable names change. As well as the data types. Note that the paths are different in the Proc Import steps. Are they supposed to be to the same Excel file or two different ones with the same name. If the later then the content issues come into play.&lt;/P&gt;
&lt;P&gt;proc import datafile="/folders/myfolders//ABC-P WEEKLY CLAIMS REPORT.XLSX"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;FONT color="#ff0000"&gt;^second / not in below&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;proc import datafile="/folders/myfolders/ABC-P WEEKLY CLOSED CLAIMS REPORT.XLSX"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect that if you rerun the import for that set again and run proc contents on the set or investigate the variables with other tools that you will find those variables mentions as "uninitialized" do not exist in the data. Possibly something with similar spelling is there but computer programs are picky.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Because you used the construct:&lt;/P&gt;
&lt;P&gt;Data work.abc2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set work.abc2;&lt;/P&gt;
&lt;P&gt;you have replaced your initial data set and cannot verify that the import included the problem variables, though likely they appear far to the right of the data next to the variables you were attempting to calculate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Sep 2018 23:06:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Variable-is-uninitialized/m-p/497196#M6250</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-09-19T23:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: Variable is uninitialized</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Variable-is-uninitialized/m-p/497465#M6256</link>
      <description>&lt;P&gt;Thanks for the help.&amp;nbsp; The mistake that you pointed out in the code in fact does not exist because I removed couple folders in the path to keep the business info confidential and I missed taking one "/" out.&amp;nbsp; Of course, I should have done better and thanks for pointing that out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The thing is that I ran this code in PC SAS for many months and it never had any problem.&amp;nbsp; However, when I tried to run it in SAS Studio, it gave me this variable not initialized issue.&amp;nbsp; I am the one who created the data and so I know for sure that the fields exist in Excel and the names are identical in both ABC-1 and ABC-2 (one again, I changed the name of the data set in the code to keep the business info unrevealed).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there something different in the variable naming rules between PC SAS and SAS Studio?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 17:07:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Variable-is-uninitialized/m-p/497465#M6256</guid>
      <dc:creator>docctong</dc:creator>
      <dc:date>2018-09-20T17:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: Variable is uninitialized</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Variable-is-uninitialized/m-p/497477#M6257</link>
      <description>&lt;P&gt;As stated above, there is something about how the data is being imported via PROC IMPORT that is different. You need to actually look at the results of PROC IMPORT and see what the difference is. You can do this via PROC PRINT or viewtable or any other way of looking at the data; this must be done immediately after PROC IMPORT and not after the data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looking at your data is an excellent way to figure out what these problems are. It is a very good habit to get into.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 17:22:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Variable-is-uninitialized/m-p/497477#M6257</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-09-20T17:22:30Z</dc:date>
    </item>
    <item>
      <title>Re: Variable is uninitialized</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Variable-is-uninitialized/m-p/497479#M6258</link>
      <description>&lt;P&gt;Thanks for the suggestion.&amp;nbsp; I'll try and hopefully will find what the problem is.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 17:24:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Variable-is-uninitialized/m-p/497479#M6258</guid>
      <dc:creator>docctong</dc:creator>
      <dc:date>2018-09-20T17:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Variable is uninitialized</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Variable-is-uninitialized/m-p/498126#M6262</link>
      <description>&lt;P&gt;Have you checked the setting for SAS variable name policy in SAS Studio?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The default in SAS Display Manager is V7, which means when you import a spreadsheet from Excel, column headings will be adjusted so that there are no blanks or other illegal characters in the variable name in SAS.&amp;nbsp; Blanks in column headings are replaced with underscores, so if the column heading in Excel is &lt;STRONG&gt;Medical BI paid&lt;/STRONG&gt;, the variable name in the SAS data set will be &lt;STRONG&gt;Medical_BI_paid&lt;/STRONG&gt;.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think the default in SAS Studio is ANY, which means that the variable name will be &lt;STRONG&gt;Medical BI paid&lt;/STRONG&gt;, because the ANY variable name policy allows blanks and special characters.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To check the validvarname= setting in SAS Studio, click on the More application options icon in the upper right corner, and then click on Preferences in the menu.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="More application options icon is to the left of the question mark icon in SAS Studio" style="width: 362px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23464i55C3E72FF1EAB463/image-size/large?v=v2&amp;amp;px=999" role="button" title="More application options menu in SAS Studio has option for Preferences.jpg" alt="More application options icon is to the left of the question mark icon in SAS Studio" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;More application options icon is to the left of the question mark icon in SAS Studio&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The variable name policy setting is in the General section of Preferences, as shown in the screen shot below.&amp;nbsp; I set it to V7, because that's the naming policy I'm used to in SAS Display Manager.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAS variable name policy setting in SAS Studio is in the General section of Preferences" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23465i7F783E9D77BC02C2/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAS variable name policy setting in SAS Studio.jpg" alt="SAS variable name policy setting in SAS Studio is in the General section of Preferences" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;SAS variable name policy setting in SAS Studio is in the General section of Preferences&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I see that you have an options statement in your code examples, but it's after the PROC IMPORT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I created a small Excel spreadsheet to show the effect of the validvarname option.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Example spreadsheet to show effect of validvarname option" style="width: 582px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23466i75452424D4DEC85E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Excel spreadsheet with test claims data.jpg" alt="Example spreadsheet to show effect of validvarname option" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Example spreadsheet to show effect of validvarname option&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the code example below, the first PROC IMPORT uses validvarname=ANY.&amp;nbsp; The second PROC IMPORT uses validvarname=V7.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path=/folders/myfolders/ODS Excel examples;

options validvarname=any;

proc import datafile="&amp;amp;path/TEST claims data.xlsx"
            out=test_data_any_validvarname
            dbms=xlsx replace;
run;

proc print data=test_data_any_validvarname;
  title 'Data set immediately after PROC IMPORT';
  title2 'PROC IMPORT used validvarname=ANY policy';
run;

options validvarname=v7;

proc import datafile="&amp;amp;path/TEST claims data.xlsx"
            out=test_data_v7_validvarname
            dbms=xlsx replace;
run;

proc print data=test_data_v7_validvarname;
  title 'Data set immediately after PROC IMPORT';
  title2 'PROC IMPORT used validvarname=V7 policy';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The screen shot below shows the differences in the variable names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Output showing effect of validvarname= option" style="width: 525px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23467iD9C1AC4E842EDF7D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Output showing effect of validvarname= option.jpg" alt="Output showing effect of validvarname= option" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Output showing effect of validvarname= option&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Sep 2018 21:50:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Variable-is-uninitialized/m-p/498126#M6262</guid>
      <dc:creator>SuzanneDorinski</dc:creator>
      <dc:date>2018-09-22T21:50:16Z</dc:date>
    </item>
  </channel>
</rss>

