<?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 How to run the same procedure on all datasets within a lib.? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713007#M219904</link>
    <description>&lt;P&gt;I am new to SAS and greatly appreciate some help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have imported an excel file containing multiple worksheets; a dataset has been created based on each individual worksheet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How should i loop the codes below for all the datasets within this library 'hsefile'?&lt;/P&gt;&lt;P&gt;"STI_Index__pctchng=dif(STI_Index__Close_)/lag(STI_Index__Close_);&lt;BR /&gt;label&lt;BR /&gt;STI_Index__pctchng='STI Index Returns';"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to do a proc autoreg for all datasets as well?&lt;/P&gt;&lt;P&gt;"proc autoreg data=&lt;BR /&gt;model Reit_rp = Mkt_rp / dwprob;&lt;BR /&gt;test Mkt_rp = 1;&lt;BR /&gt;output out=reitout p=p r=r ucl=u lcl=l alphacli=.10;&lt;BR /&gt;title2;&lt;BR /&gt;title3;"&lt;/P&gt;</description>
    <pubDate>Thu, 21 Jan 2021 08:35:47 GMT</pubDate>
    <dc:creator>igsteo</dc:creator>
    <dc:date>2021-01-21T08:35:47Z</dc:date>
    <item>
      <title>How to run the same procedure on all datasets within a lib.?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713007#M219904</link>
      <description>&lt;P&gt;I am new to SAS and greatly appreciate some help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have imported an excel file containing multiple worksheets; a dataset has been created based on each individual worksheet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How should i loop the codes below for all the datasets within this library 'hsefile'?&lt;/P&gt;&lt;P&gt;"STI_Index__pctchng=dif(STI_Index__Close_)/lag(STI_Index__Close_);&lt;BR /&gt;label&lt;BR /&gt;STI_Index__pctchng='STI Index Returns';"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to do a proc autoreg for all datasets as well?&lt;/P&gt;&lt;P&gt;"proc autoreg data=&lt;BR /&gt;model Reit_rp = Mkt_rp / dwprob;&lt;BR /&gt;test Mkt_rp = 1;&lt;BR /&gt;output out=reitout p=p r=r ucl=u lcl=l alphacli=.10;&lt;BR /&gt;title2;&lt;BR /&gt;title3;"&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 08:35:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713007#M219904</guid>
      <dc:creator>igsteo</dc:creator>
      <dc:date>2021-01-21T08:35:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to run the same procedure on all datasets within a lib.?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713012#M219905</link>
      <description>&lt;P&gt;Combine the datasets into one with a view.&lt;/P&gt;
&lt;P&gt;If your different datasets constitute separate groups, do this in a data step view with the INDSNAME= option in the SET statement; you can then use BY group processing in a single procedure call.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select memname into :datasets separated by " "
from dictionary.tables
where libname = "XXX";
quit;

data all / view=all;
length ds dsname $41;
set &amp;amp;datasets. indsname=ds;
dsname = ds;
run;

proc autoreg data=all;
by dsname;
/* further code */&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Jan 2021 08:51:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713012#M219905</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-01-21T08:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to run the same procedure on all datasets within a lib.?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713273#M220014</link>
      <description>&lt;P&gt;I want to combine all datasets in the library. Would this mean my code is as follows for proc sql?&lt;/P&gt;&lt;P&gt;I tried it but it doesn't seem to capture. or do i have to enter every single name after 'select'?&lt;/P&gt;&lt;P&gt;appreciate the help rendered!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="sas"&gt;proc sql noprint;
select memname into :datasets separated by " "
from dictionary.tables
where libname = "hsefile";
quit;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2021 03:00:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713273#M220014</guid>
      <dc:creator>igsteo</dc:creator>
      <dc:date>2021-01-22T03:00:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to run the same procedure on all datasets within a lib.?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713274#M220015</link>
      <description>&lt;P&gt;Try changing your LIBNAME selection to uppercase:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where libname = "HSEFILE";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Jan 2021 03:04:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713274#M220015</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-01-22T03:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to run the same procedure on all datasets within a lib.?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713287#M220022</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC CONTENTS DATA=hsefile._ALL_ ; 
RUN;
proc sql;
select memname into :datasets separated by " "
from dictionary.tables
where libname = "HSEFILE";
quit;
%macro want;
%do i=1 %to 36;
Index__pctchng=dif(Index__Close_)/lag(Index__Close_);
%end;
%want;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Would a macros work to perform the same calculation on all members in the list created using procsql? What's the alternate codes if this should not function?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;each member has the stock ticker ending with a number i.e. TSLA_1, AAPL_2.&lt;/P&gt;&lt;P&gt;Hence, i'm trying to specify calculations to be ran from e.g. 1 to 36.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2021 05:56:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713287#M220022</guid>
      <dc:creator>igsteo</dc:creator>
      <dc:date>2021-01-22T05:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to run the same procedure on all datasets within a lib.?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713307#M220039</link>
      <description>&lt;P&gt;When working with the dictionary tables, library and library member (dataset, view, catalog) names must always be specified in uppercase.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: the above is true for SAS libraries; databases used via SAS/ACCESS may behave differently (see &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;'s post).&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2021 15:08:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713307#M220039</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-01-22T15:08:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to run the same procedure on all datasets within a lib.?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713311#M220041</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;When working with the dictionary tables, library and library member (dataset, view, catalog) names must always be specified in uppercase.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Unfortunately some exceptions exist when using MySQL-tables:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;the variable memname in sashelp.vtable and sashelp.vcolum seems to be all lower-case.&lt;/LI&gt;
&lt;LI&gt;the variable name in sashelp.vcolumn is mixed-case, matching the case that is used in the database&lt;/LI&gt;
&lt;LI&gt;all this may depend on how the database is accessed&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Fri, 22 Jan 2021 09:29:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713311#M220041</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-01-22T09:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to run the same procedure on all datasets within a lib.?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713797#M220274</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="language-sas"&gt;&lt;CODE&gt;data all / view=all;
length ds dsname $41;
set &amp;amp;datasets. indsname=ds;
dsname = ds;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I seem to be getting an error on the third line. As i'm new to SAS, am i supposed to change &amp;amp;datasets to all 40 datasets that i have? or can i just specify the library name?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, ;, CUROBS,&lt;BR /&gt;END, INDSNAME, KEY, KEYRESET, KEYS, NOBS, OPEN, POINT, _DATA_, _LAST_, _NULL_.&lt;/P&gt;&lt;P&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference DATASETS not resolved.&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: CUROBS, END, INDSNAME, KEY, KEYRESET,&lt;BR /&gt;KEYS, NOBS, POINT.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2021 02:12:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713797#M220274</guid>
      <dc:creator>igsteo</dc:creator>
      <dc:date>2021-01-25T02:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to run the same procedure on all datasets within a lib.?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713798#M220275</link>
      <description>&lt;P&gt;Macro variable datasets has not been set. Check if the SQL step can find any datasets.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2021 02:33:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713798#M220275</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-01-25T02:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to run the same procedure on all datasets within a lib.?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713802#M220278</link>
      <description>&lt;P&gt;i did print the proc sql and it reflects all the members in the library that was specified.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2021 02:53:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713802#M220278</guid>
      <dc:creator>igsteo</dc:creator>
      <dc:date>2021-01-25T02:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to run the same procedure on all datasets within a lib.?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713804#M220280</link>
      <description>&lt;P&gt;The log is very clear, macro variable datasets has not been defined.&lt;/P&gt;
&lt;P&gt;Run both steps in one submit, and post the complete log. Use the &amp;lt;/&amp;gt; button for posting the log, DO NOT SKIP THIS.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2021 03:05:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713804#M220280</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-01-25T03:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to run the same procedure on all datasets within a lib.?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713837#M220297</link>
      <description>&lt;P&gt;Thank you for all the help i have combined all datasets into a table. However, as you can see only WORK.FCT appears to have created a separate 'adjusted close' column when it has the same variable as the other datasets. I have checked my excel file and all layout is uniform. How could i solve this?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2021 08:48:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713837#M220297</guid>
      <dc:creator>igsteo</dc:creator>
      <dc:date>2021-01-25T08:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to run the same procedure on all datasets within a lib.?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713852#M220304</link>
      <description>&lt;P&gt;So your real issue is the use of manually entered (therefore the typo in the column name) data in a mostly unusable file format (Excel) which forces you to clean the data first before working with it.&lt;/P&gt;
&lt;P&gt;If you want to do&amp;nbsp;&lt;EM&gt;any successful&lt;/EM&gt; automation here, you have to&amp;nbsp;&lt;U&gt;insist&lt;/U&gt; that the data be sent in a usable file format (csv or fixed column width) where you can consistently set variable attributes in the data step that reads the data into SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2021 08:42:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713852#M220304</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-01-25T08:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to run the same procedure on all datasets within a lib.?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713854#M220306</link>
      <description>&lt;P&gt;Thank you for all the help!&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2021 08:49:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-run-the-same-procedure-on-all-datasets-within-a-lib/m-p/713854#M220306</guid>
      <dc:creator>igsteo</dc:creator>
      <dc:date>2021-01-25T08:49:08Z</dc:date>
    </item>
  </channel>
</rss>

