<?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: get stuck by a simple proc export in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/get-stuck-by-a-simple-proc-export/m-p/713072#M219926</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for teaching me this!&lt;/P&gt;
&lt;P&gt;The help I get from this forum are always very much appreciated!&lt;/P&gt;</description>
    <pubDate>Thu, 21 Jan 2021 14:12:59 GMT</pubDate>
    <dc:creator>superbug</dc:creator>
    <dc:date>2021-01-21T14:12:59Z</dc:date>
    <item>
      <title>get stuck by a simple proc export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-stuck-by-a-simple-proc-export/m-p/712959#M219871</link>
      <description>&lt;P&gt;I used the following syntax to read in a bunch of .csv file. Each file being read in contains &lt;STRONG&gt;250&lt;/STRONG&gt; rows. I then stacked them together, get a "want" dataset.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro  yy (pretest);
options obs=253;
proc import datafile=".....\&amp;amp;test..csv"
dbms=csv replace out=&amp;amp;test;
guessingrows=max;
datarow=4;
run;
%Mend;
%PT(PAA08600);
%PT(PAA08601);
%PT(PAA08602);
%PT(PAA08603);
%PT(PAA08604);

/* stack all files*/
data want;
set PAA08600  
PAA08601 
PAA08602 
PAA08603 
PAA08604
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I checked the stacked file, i.e. want data, the records/lines are the correct number, which is &lt;STRONG&gt;1250&lt;/STRONG&gt; rows, but when I export "want" using the following code, it turned out the resulted data in the designated folder only contains records for one file/test, i.e., &lt;STRONG&gt;250&lt;/STRONG&gt; rows. I can't figure out why. Please help. Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc export data=want
outfile="....\want.csv"
dbms=csv replace; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Jan 2021 02:29:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-stuck-by-a-simple-proc-export/m-p/712959#M219871</guid>
      <dc:creator>superbug</dc:creator>
      <dc:date>2021-01-21T02:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: get stuck by a simple proc export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-stuck-by-a-simple-proc-export/m-p/712960#M219872</link>
      <description>&lt;P&gt;sorry, there is a typo in the code I posted. the correct code should be following&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;%macro PT(pretest);
options obs=253;
proc import datafile=".....\&amp;amp;test..csv"
dbms=csv replace out=&amp;amp;test;
guessingrows=max;
datarow=4;
run;
%Mend;
%PT(PAA08600);
%PT(PAA08601);
%PT(PAA08602);
%PT(PAA08603);
%PT(PAA08604);

/* stack all files*/
data want;
set PAA08600  
PAA08601 
PAA08602 
PAA08603 
PAA08604&lt;/LI-CODE&gt;
&lt;P&gt;the export data "want"&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;proc export data=want
outfile="....\want.csv"
dbms=csv replace; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 02:33:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-stuck-by-a-simple-proc-export/m-p/712960#M219872</guid>
      <dc:creator>superbug</dc:creator>
      <dc:date>2021-01-21T02:33:35Z</dc:date>
    </item>
    <item>
      <title>Re: get stuck by a simple proc export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-stuck-by-a-simple-proc-export/m-p/712961#M219873</link>
      <description>&lt;P&gt;Set&amp;nbsp; - options obs = MAX; - before your DATA step WANT.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 02:46:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-stuck-by-a-simple-proc-export/m-p/712961#M219873</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-01-21T02:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: get stuck by a simple proc export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-stuck-by-a-simple-proc-export/m-p/712962#M219874</link>
      <description>In addition to option obs=max change, I suspect you need to use the PRETEST macro variable not the TEST macro variable. You're reading the same data set and processing it multiple times, but you only have one data set in the end, whatever your TEST variable is. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Jan 2021 02:53:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-stuck-by-a-simple-proc-export/m-p/712962#M219874</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-01-21T02:53:25Z</dc:date>
    </item>
    <item>
      <title>Re: get stuck by a simple proc export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-stuck-by-a-simple-proc-export/m-p/712963#M219875</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks you both so much!&lt;/P&gt;
&lt;P&gt;Very much appreciate your help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 02:59:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-stuck-by-a-simple-proc-export/m-p/712963#M219875</guid>
      <dc:creator>superbug</dc:creator>
      <dc:date>2021-01-21T02:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: get stuck by a simple proc export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-stuck-by-a-simple-proc-export/m-p/712965#M219877</link>
      <description>&lt;P&gt;You "typo" fix actually still means nothing from what you show. The name of the macro parameter is Pretest and you do not use &amp;amp;pretest anywhere. So the question might be what does &amp;amp;test represent and where was it set.&lt;/P&gt;
&lt;P&gt;You also don't show ending the data Want step at all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And why did you bother to set Options obs=253????.&lt;/P&gt;
&lt;P&gt;But you do need to set it back as the option stays in effect until reset.&lt;/P&gt;
&lt;P&gt;In general inside any macro that sets SYSTEM options you should make sure to set them back before the end of the macro.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 03:12:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-stuck-by-a-simple-proc-export/m-p/712965#M219877</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-01-21T03:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: get stuck by a simple proc export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-stuck-by-a-simple-proc-export/m-p/712966#M219878</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for catching those typo.&lt;/P&gt;
&lt;P&gt;I edited the code before posting, which resulted typo error.&lt;/P&gt;
&lt;P&gt;It should be pretest inside the macro.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For data stacking portion, I forgot to end the code with semicolon and "run".&lt;/P&gt;
&lt;P&gt;I will be very careful next time checking the code before I post.&lt;/P&gt;
&lt;P&gt;Thanks again!&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 03:19:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-stuck-by-a-simple-proc-export/m-p/712966#M219878</guid>
      <dc:creator>superbug</dc:creator>
      <dc:date>2021-01-21T03:19:04Z</dc:date>
    </item>
    <item>
      <title>Re: get stuck by a simple proc export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-stuck-by-a-simple-proc-export/m-p/712974#M219880</link>
      <description>&lt;P&gt;There are reasons that we suggest posting the LOG so often. It is very easy to retype something and introduce errors. Copy the data step, procedure or combinations that seem not work from the LOG and paste them into a text box opened on the forum with the &amp;lt;/&amp;gt; icon.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When debugging macro code you often want to use the system option MPRINT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;options mprint;&lt;/P&gt;
&lt;P&gt;%mymacrocall&lt;/P&gt;
&lt;P&gt;options nomprint; /* turn if off*/&lt;/P&gt;
&lt;P&gt;The Mprint option will show details of the code generated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And a very good habit to get into is always end a data step or procedure called in a macro with the Run; statement.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 04:59:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-stuck-by-a-simple-proc-export/m-p/712974#M219880</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-01-21T04:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: get stuck by a simple proc export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-stuck-by-a-simple-proc-export/m-p/713072#M219926</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for teaching me this!&lt;/P&gt;
&lt;P&gt;The help I get from this forum are always very much appreciated!&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 14:12:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-stuck-by-a-simple-proc-export/m-p/713072#M219926</guid>
      <dc:creator>superbug</dc:creator>
      <dc:date>2021-01-21T14:12:59Z</dc:date>
    </item>
  </channel>
</rss>

