<?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 not found in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Variable-not-found/m-p/663914#M22817</link>
    <description>Sorry for my basic question but how do I do that?&lt;BR /&gt;</description>
    <pubDate>Mon, 22 Jun 2020 06:00:11 GMT</pubDate>
    <dc:creator>duckypooh</dc:creator>
    <dc:date>2020-06-22T06:00:11Z</dc:date>
    <item>
      <title>Variable not found</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Variable-not-found/m-p/663909#M22814</link>
      <description>&lt;P&gt;Hello all!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an error: variable not found.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;libname Analysis '/folders/myfolders/research';

proc import out= Analysis.DetailedCMA datafile= "/folders/myfolders/Research/Analysis 1906/CMA 1906.xlsx" 
DBMS=xlsx Replace; SHEET="Detailed CMA"; 
GETNAMES=YES;
RUN;

data import; set import;

title 'Summary statistics';
proc means data=import ndec=2 n mean std median p25 p75 min max; var BMI;  run;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; 
 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         title 'Summary statistics';
 74         proc means data=import ndec=2 n mean std median p25 p75 min max; var BMI;  run;
 ERROR: Variable BMI not found.
 
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE MEANS used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 75         
 76         
 77         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 89         &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I have also tried creating a new variable: BMI_1 on the excel sheet where BMI_1 = BMI *1, to convert all values in BMI to numeric. But SAS cant recognize BMI_1 either.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2020 04:03:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Variable-not-found/m-p/663909#M22814</guid>
      <dc:creator>duckypooh</dc:creator>
      <dc:date>2020-06-22T04:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: Variable not found</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Variable-not-found/m-p/663912#M22816</link>
      <description>&lt;P&gt;Inspect the dataset to see how the columns were imported.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2020 05:22:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Variable-not-found/m-p/663912#M22816</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-22T05:22:25Z</dc:date>
    </item>
    <item>
      <title>Re: Variable not found</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Variable-not-found/m-p/663914#M22817</link>
      <description>Sorry for my basic question but how do I do that?&lt;BR /&gt;</description>
      <pubDate>Mon, 22 Jun 2020 06:00:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Variable-not-found/m-p/663914#M22817</guid>
      <dc:creator>duckypooh</dc:creator>
      <dc:date>2020-06-22T06:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: Variable not found</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Variable-not-found/m-p/663916#M22818</link>
      <description>&lt;P&gt;Please check by opening the dataset which you imported and see if there us a variable by name bmi.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2020 06:15:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Variable-not-found/m-p/663916#M22818</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2020-06-22T06:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: Variable not found</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Variable-not-found/m-p/663920#M22819</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have checked and it seems like when importing the dataset, some variables were renamed from their excel version. E.g. 'Age' on excel became 'AA' etc. How can i change the variables back to their original names?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2020 06:32:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Variable-not-found/m-p/663920#M22819</guid>
      <dc:creator>duckypooh</dc:creator>
      <dc:date>2020-06-22T06:32:44Z</dc:date>
    </item>
    <item>
      <title>Re: Variable not found</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Variable-not-found/m-p/663921#M22820</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname Analysis '/folders/myfolders/research';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This creates a library reference for the path you specified.&lt;/P&gt;
&lt;P&gt;Inspect the log to see if it worked.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import out= Analysis.DetailedCMA datafile= "/folders/myfolders/Research/Analysis 1906/CMA 1906.xlsx" 
DBMS=xlsx Replace; SHEET="Detailed CMA"; 
GETNAMES=YES;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This tries to import a file in a&amp;nbsp;&lt;EM&gt;different&lt;/EM&gt; path (note the capital R in Research) to this library. Inspect the log to see if the file was successfully imported.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data import; set import;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This is a data step that does essentially nothing, except wasting time. It just overwrites a dataset in WORK with itself (if it existed at all). Remove it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title 'Summary statistics';
proc means data=import ndec=2 n mean std median p25 p75 min max; var BMI;  run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This tries to run summary statistics on the dataset in WORK (not on the dataset you tried to import in the first step!).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bottom line: inspect the log to see what worked; fix problems from the top down, and make sure you are consistent in using libraries and dataset names.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2020 06:53:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Variable-not-found/m-p/663921#M22820</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-22T06:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: Variable not found</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Variable-not-found/m-p/663924#M22822</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/332933"&gt;@duckypooh&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have checked and it seems like when importing the dataset, some variables were renamed from their excel version. E.g. 'Age' on excel became 'AA' etc. How can i change the variables back to their original names?&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Make sure column names are in row 1, and that data starts in row 2 in the spreadsheet.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2020 06:53:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Variable-not-found/m-p/663924#M22822</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-22T06:53:13Z</dc:date>
    </item>
    <item>
      <title>Re: Variable not found</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Variable-not-found/m-p/664015#M22832</link>
      <description>&lt;P&gt;Comment your code with what you think is happening to avoid issues like this.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;When you import your data you're calling it : analysis.detailedCMA. However, when you try and use it, you're trying to use some data set called IMPORT instead? Is that a data set from somewhere else, or were you intending to use the CMA data?&lt;/P&gt;
&lt;P&gt;The SAS programming classes are free and I would highly recommend taking some time to go through it if you're trying to learn SAS, especially if you're not familiar with the basic concepts yet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*assigns a location where you can save your files between sessions;
libname Analysis '/folders/myfolders/research';

*imports the data;
*data is saved to analysis.detailedCMA;
proc import out= Analysis.DetailedCMA datafile= "/folders/myfolders/Research/Analysis 1906/CMA 1906.xlsx" 
DBMS=xlsx Replace; SHEET="Detailed CMA"; 
GETNAMES=YES;
RUN;

*not sure what this is doing?????;
*data import; set import;

*Assume you intended this to summarize your analysis.detailedCMA data;
*it would run on any numerical variable;
title 'Summary statistics';
proc means data=analysis.detailedCMA ndec=2 n mean std median p25 p75 min max; var BMI;  run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's an example on calculating BMI and adding that to a data set.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;    data class;
    	set sashelp.class;
    	length category $20.;
    	bmi = 703*(weight/(height**2));

    	if bmi &amp;lt; 18 then
    		category='Under Weight';
    	else if 18 &amp;lt;= BMI &amp;lt; 25 then
    		category='Normal';
    	else if 25 &amp;lt;= BMI &amp;lt; 30 then
    		category ='Over Weight';
    	else if BMI &amp;gt;=30 then
    		category = 'Obese';
    run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2020 16:00:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Variable-not-found/m-p/664015#M22832</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-06-22T16:00:06Z</dc:date>
    </item>
  </channel>
</rss>

