<?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: How do I use  &amp;quot;Where&amp;quot; statement and &amp;quot;like&amp;quot; operator in Proc Import step prop in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915810#M40984</link>
    <description>&lt;P&gt;It did not give me a problem. The only problem is that it creates a table that lists the memname. How can I get that table from the library I just created and create a new table from it. Plus when I go to the library I created, the table won't open because the name is not SAS friendly. In reality I just want to import one sheet at a time without having to open the entire workbook every time just to figure out what the sheet name is. Especially if there are several sheets in a work book, which there are. Is there any way around this?&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;JFuchsia&lt;/P&gt;</description>
    <pubDate>Tue, 13 Feb 2024 14:01:33 GMT</pubDate>
    <dc:creator>JFuchsia</dc:creator>
    <dc:date>2024-02-13T14:01:33Z</dc:date>
    <item>
      <title>How do I use  "Where" statement and "like" operator in Proc Import step properly?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915707#M40974</link>
      <description>&lt;P&gt;How can I use a where statement and a like operator for sheet to retrieve the proper sheet with a partial name?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Right now this worked:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc import datafile="B:\123\file.xls"
     out=table1
	dbms=excel replace;
   where sheet like 'Heat Map';
     getnames=yes;
	 scantext=yes;

run; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But it gives me red text for "where" and a warning in green:&lt;CODE class=""&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;WARNING: No data sets qualify for WHERE processing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I make this work without red text and without warnings?&lt;/P&gt;&lt;P&gt;I know there is a proper way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;JFuchsia&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2024 21:40:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915707#M40974</guid>
      <dc:creator>JFuchsia</dc:creator>
      <dc:date>2024-02-12T21:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use  "Where" statement and "like" operator in Proc Import step prop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915723#M40975</link>
      <description>&lt;P&gt;What you're trying to do is afaik not supported nor documented syntax for Proc Import.&lt;/P&gt;
&lt;P&gt;You could use a libname with the xlsx engine and then search for the table with a like operator using Proc SQL&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select libname, memname
from dictionary.tables
where libname='&amp;lt;libref&amp;gt;' and memname like '....'
;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Feb 2024 22:36:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915723#M40975</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-02-12T22:36:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use  "Where" statement and "like" operator in Proc Import step prop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915726#M40976</link>
      <description>&lt;P&gt;This approach did not work.&amp;nbsp; I received notes indicating that there were two tables not returned or displayed because the name was too long.&lt;/P&gt;&lt;P&gt;I also want to output a table from the sheet that is selected, and that doesn't seem possible with this approach. Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2024 23:10:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915726#M40976</guid>
      <dc:creator>JFuchsia</dc:creator>
      <dc:date>2024-02-12T23:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use  "Where" statement and "like" operator in Proc Import step prop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915732#M40977</link>
      <description>&lt;P&gt;PS. It didn't work, I just got lucky the first time.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 00:28:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915732#M40977</guid>
      <dc:creator>JFuchsia</dc:creator>
      <dc:date>2024-02-13T00:28:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use  "Where" statement and "like" operator in Proc Import step prop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915739#M40978</link>
      <description>&lt;P&gt;Is there some reason you have the ancient (and undocumented) XLS file format instead of the modern (and documented) XLSX file format?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you had an XLSX file then you can use the XLSX libref engine and discover the sheet names.&amp;nbsp; Or just read the XML file that is embedded in the XLSX file to find the sheet names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there some reason why you don't know the sheet names in the XLS workbook?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does the workbook have more than one worksheet?&amp;nbsp; If it does not then it does not matter to PROC IMPORT as it will just read the first worksheet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 01:30:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915739#M40978</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-02-13T01:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use  "Where" statement and "like" operator in Proc Import step prop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915740#M40979</link>
      <description>&lt;P&gt;It's just that the sheet names are always some form of the main name, in this case "Heat Map".&amp;nbsp; There are multiple sheets and I don't want just the first one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for checking.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 01:33:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915740#M40979</guid>
      <dc:creator>JFuchsia</dc:creator>
      <dc:date>2024-02-13T01:33:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use  "Where" statement and "like" operator in Proc Import step prop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915751#M40980</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/463731"&gt;@JFuchsia&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;It's just that the sheet names are always some form of the main name, in this case "Heat Map".&amp;nbsp; There are multiple sheets and I don't want just the first one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for checking.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you cannot change the process to use XLSX files instead of XLS files then you will need to find some non-SAS program that can get the list of sheetnames from a XLS file.&amp;nbsp; &amp;nbsp;If you are allowed to run operating system commands from your SAS program then you could call such a program from your SAS program and read the results into a dataset so that you could use it to pick the sheets you want to read.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And if your copy of SAS is running on Windows then you could probably create such a program using a Visual Basic program.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 03:13:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915751#M40980</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-02-13T03:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use  "Where" statement and "like" operator in Proc Import step prop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915798#M40982</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options validmemname=extend;

libname my_excel excel "B:\123\file.xls";

proc sql;
create table sheets as
  select memname
  from dictionary.tables
  where libname = "MY_EXCEL" and upcase(memname) like '%HEAT MAP%'
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If that gives you problems, post the complete log.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 12:02:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915798#M40982</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-02-13T12:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use  "Where" statement and "like" operator in Proc Import step prop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915810#M40984</link>
      <description>&lt;P&gt;It did not give me a problem. The only problem is that it creates a table that lists the memname. How can I get that table from the library I just created and create a new table from it. Plus when I go to the library I created, the table won't open because the name is not SAS friendly. In reality I just want to import one sheet at a time without having to open the entire workbook every time just to figure out what the sheet name is. Especially if there are several sheets in a work book, which there are. Is there any way around this?&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;JFuchsia&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 14:01:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915810#M40984</guid>
      <dc:creator>JFuchsia</dc:creator>
      <dc:date>2024-02-13T14:01:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use  "Where" statement and "like" operator in Proc Import step prop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915815#M40985</link>
      <description>&lt;P&gt;So you are lucky.&amp;nbsp; I appear to be running on Windows and your version of SAS and your version of EXCEL are compatible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you have the list of the names of the worksheets in a dataset you can use that to generate code to read the sheets you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure what you mean about "&lt;SPAN&gt;open the entire workbook every time".&amp;nbsp; How else can you tell what is in a file without opening it?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Also not sure what you mean by "the table won't open because the name is not SAS friendly".&amp;nbsp; What "table" is that?&amp;nbsp; Did you mean the MEMNAME values returned by the query to DICTIONARY.TABLES are not valid V7 SAS names?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt; That should not cause any trouble when using them as the SHEET name in PROC IMPORT code.&amp;nbsp; &amp;nbsp;If you want to use them as MEMNAME values to reference the worksheet using the libref you created with the EXCEL engine then you will need to do two things.&amp;nbsp; First is set the VALIDMEMNAME option to EXTEND.&amp;nbsp; And second is convert them to valid SAS names by using name literals.&amp;nbsp; You can use the NLITERAL() function to do that.&amp;nbsp; Or if the names do not contain and single quote characters just wrap it with single quotes and append the letter N.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So perhaps something like this to copy all of the selected sheets into datasets in the WORK library.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname my_excel excel "B:\123\file.xls";

proc sql;
select nliteral(memname) into :memlist separated by ' '
  from dictionary.tables
  where libname = "MY_EXCEL"
    and upcase(memname) like '%HEAT MAP%'
;
quit;

proc copy inlib=my_excel outlib=work;
  select &amp;amp;memlist;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;But you might want to make up some more friendly names of the datasets you create from the worksheet.&amp;nbsp; Names that are valid SAS names and so do not need name literals to reference or using VALIDMEMNAME=extend setting to use them in the future.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 14:22:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915815#M40985</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-02-13T14:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use  "Where" statement and "like" operator in Proc Import step prop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915822#M40987</link>
      <description>&lt;P&gt;This worked for getting my table out. How can I rename the table?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!!!&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 14:42:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915822#M40987</guid>
      <dc:creator>JFuchsia</dc:creator>
      <dc:date>2024-02-13T14:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use  "Where" statement and "like" operator in Proc Import step prop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915825#M40988</link>
      <description>&lt;P&gt;You could rename them after the fact. Look at PROC DATASETS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or copy them one by one using DATA steps instead so that you can chose the name that is used.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data good_name;
  set my_excel.'bad name'n;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 14:47:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915825#M40988</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-02-13T14:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use  "Where" statement and "like" operator in Proc Import step prop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915826#M40989</link>
      <description>&lt;P&gt;Figured&amp;nbsp; it out!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="sas"&gt;data sheet;
  set my_excel.&amp;amp;memlist;
run;&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 13 Feb 2024 14:49:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915826#M40989</guid>
      <dc:creator>JFuchsia</dc:creator>
      <dc:date>2024-02-13T14:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use  "Where" statement and "like" operator in Proc Import step prop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915838#M40990</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/463731"&gt;@JFuchsia&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Figured&amp;nbsp; it out!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;data sheet;
  set my_excel.&amp;amp;memlist;
run;&lt;/LI-CODE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That will only work when you only found one matching sheet name.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 15:01:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-I-use-quot-Where-quot-statement-and-quot-like-quot/m-p/915838#M40990</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-02-13T15:01:37Z</dc:date>
    </item>
  </channel>
</rss>

