<?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: Infile and snippet issues - SAS University in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Infile-and-snippet-issues-SAS-University/m-p/319761#M1659</link>
    <description>&lt;P&gt;The issues you are experiencing are not SAS University Edition related but SAS syntax related. You can't have a PROC step within a data step. This is the cause of your issue and most likely you would have had error messages relating to this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Rearranging your code is the first step and then I'd look at enhancing your conditional statements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind Regards,&lt;/P&gt;
&lt;P&gt;Michelle&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/** Import an XLSX file.  **/

PROC IMPORT DATAFILE="/folders/myfolders/COVER.XLSX"
		    OUT=WORK.COVER
		    DBMS=XLSX
		    REPLACE;
RUN;



DATA DAILY;

SET WORK.COVER;  * This was missing in your code and is needed for SAS to read the data you imported in the process import step above;

IF MONTH=. THEN DELETE;

SUR_TYPE='AU';

****** DEFINE TIME BLOCKS ****;

IF MONTH=3 THEN BLOCK='1_MAR';
IF MONTH=4 THEN BLOCK='2_APR';
IF MONTH=5 THEN BLOCK='3_MAY';

******* DEFINE TIME BLOCK SIZE ********;

IF MONTH=3 THEN DO;  N=31; N2=9; N1=N-N2; END;
IF MONTH=4 THEN DO;  N=30; N2=8; N1=N-N2; END;
IF MONTH=5 THEN DO;  N=31; N2=11; N1=N-N2; END;

****** DEFINE DAY TYPES ******;


IF DAYTYPE=1 THEN DAY_TYPE='WD';
IF DAYTYPE=2 THEN DAY_TYPE='WE';


****** TIME PERIOD HOURS ARE ENTERED ON THE COVER FORM;

****** DEFINE SAMPLING PROBABILITIES *****;

IF PERIOD=1 THEN TPROB=0.3;
IF PERIOD=2 THEN TPROB=0.7;

IF SITE = 701 THEN SPROB=0.6;
IF SITE = 790 THEN SPROB=0.4;

RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 18 Dec 2016 01:47:20 GMT</pubDate>
    <dc:creator>MichelleHomes</dc:creator>
    <dc:date>2016-12-18T01:47:20Z</dc:date>
    <item>
      <title>Infile and snippet issues - SAS University</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Infile-and-snippet-issues-SAS-University/m-p/319758#M1658</link>
      <description>&lt;P&gt;I am new to SAS University but not SAS. I was hoping for a smoother transition but it hasnt gone that way so far. &amp;nbsp;I have a long program that initially uses 3 excel files. I have always used the infile statement to infile the data as a prn file. &amp;nbsp;Then follow the infile statement with an input statement to name the variables. &amp;nbsp;Thats not working at all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I tried using the snippet tool to bring in each file as an XLSX file. &amp;nbsp;I seem to be able to bring in the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But heres the dumb part - now what? &amp;nbsp;Ideally, I would like to bring in a file and then immediately do some manipulations to create new variables. &amp;nbsp;Then bring in the next file and do the same. Then the same thing with the third file. &amp;nbsp;But after I successfully bring in a file with the snippet tool, every single one of my If-Then statements is invalid.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am at a loss now and need some help. I can share all my coding if needed. &amp;nbsp;Hopefully, I have made myself somewhat clear. Thanks in advance. &amp;nbsp;Below is an example of the first import. Every If-Then statement after that has an error message.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DATA DAILY;&lt;BR /&gt;&lt;BR /&gt;/** Import an XLSX file.  **/&lt;BR /&gt;&lt;BR /&gt;PROC IMPORT DATAFILE="/folders/myfolders/COVER.XLSX"&lt;BR /&gt;		    OUT=WORK.COVER&lt;BR /&gt;		    DBMS=XLSX&lt;BR /&gt;		    REPLACE;&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;IF MONTH=. THEN DELETE;&lt;BR /&gt;&lt;BR /&gt;SUR_TYPE='AU';&lt;BR /&gt;&lt;BR /&gt;****** DEFINE TIME BLOCKS ****;&lt;BR /&gt;&lt;BR /&gt;IF MONTH=3 THEN BLOCK='1_MAR';&lt;BR /&gt;IF MONTH=4 THEN BLOCK='2_APR';&lt;BR /&gt;IF MONTH=5 THEN BLOCK='3_MAY';&lt;BR /&gt;&lt;BR /&gt;******* DEFINE TIME BLOCK SIZE ********;&lt;BR /&gt;&lt;BR /&gt;IF MONTH=3 THEN DO;  N=31; N2=9; N1=N-N2; END;&lt;BR /&gt;IF MONTH=4 THEN DO;  N=30; N2=8; N1=N-N2; END;&lt;BR /&gt;IF MONTH=5 THEN DO;  N=31; N2=11; N1=N-N2; END;&lt;BR /&gt;&lt;BR /&gt;****** DEFINE DAY TYPES ******;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;IF DAYTYPE=1 THEN DAY_TYPE='WD';&lt;BR /&gt;IF DAYTYPE=2 THEN DAY_TYPE='WE';&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;****** TIME PERIOD HOURS ARE ENTERED ON THE COVER FORM;&lt;BR /&gt;&lt;BR /&gt;****** DEFINE SAMPLING PROBABILITIES *****;&lt;BR /&gt;&lt;BR /&gt;IF PERIOD=1 THEN TPROB=0.3;&lt;BR /&gt;IF PERIOD=2 THEN TPROB=0.7;&lt;BR /&gt;&lt;BR /&gt;IF SITE = 701 THEN SPROB=0.6;&lt;BR /&gt;IF SITE = 790 THEN SPROB=0.4;&lt;BR /&gt;&lt;BR /&gt;RUN;&lt;/PRE&gt;</description>
      <pubDate>Sun, 18 Dec 2016 00:49:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Infile-and-snippet-issues-SAS-University/m-p/319758#M1658</guid>
      <dc:creator>vicdicenzo</dc:creator>
      <dc:date>2016-12-18T00:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: Infile and snippet issues - SAS University</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Infile-and-snippet-issues-SAS-University/m-p/319761#M1659</link>
      <description>&lt;P&gt;The issues you are experiencing are not SAS University Edition related but SAS syntax related. You can't have a PROC step within a data step. This is the cause of your issue and most likely you would have had error messages relating to this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Rearranging your code is the first step and then I'd look at enhancing your conditional statements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind Regards,&lt;/P&gt;
&lt;P&gt;Michelle&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/** Import an XLSX file.  **/

PROC IMPORT DATAFILE="/folders/myfolders/COVER.XLSX"
		    OUT=WORK.COVER
		    DBMS=XLSX
		    REPLACE;
RUN;



DATA DAILY;

SET WORK.COVER;  * This was missing in your code and is needed for SAS to read the data you imported in the process import step above;

IF MONTH=. THEN DELETE;

SUR_TYPE='AU';

****** DEFINE TIME BLOCKS ****;

IF MONTH=3 THEN BLOCK='1_MAR';
IF MONTH=4 THEN BLOCK='2_APR';
IF MONTH=5 THEN BLOCK='3_MAY';

******* DEFINE TIME BLOCK SIZE ********;

IF MONTH=3 THEN DO;  N=31; N2=9; N1=N-N2; END;
IF MONTH=4 THEN DO;  N=30; N2=8; N1=N-N2; END;
IF MONTH=5 THEN DO;  N=31; N2=11; N1=N-N2; END;

****** DEFINE DAY TYPES ******;


IF DAYTYPE=1 THEN DAY_TYPE='WD';
IF DAYTYPE=2 THEN DAY_TYPE='WE';


****** TIME PERIOD HOURS ARE ENTERED ON THE COVER FORM;

****** DEFINE SAMPLING PROBABILITIES *****;

IF PERIOD=1 THEN TPROB=0.3;
IF PERIOD=2 THEN TPROB=0.7;

IF SITE = 701 THEN SPROB=0.6;
IF SITE = 790 THEN SPROB=0.4;

RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Dec 2016 01:47:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Infile-and-snippet-issues-SAS-University/m-p/319761#M1659</guid>
      <dc:creator>MichelleHomes</dc:creator>
      <dc:date>2016-12-18T01:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: Infile and snippet issues - SAS University</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Infile-and-snippet-issues-SAS-University/m-p/319782#M1660</link>
      <description>&lt;P&gt;Your method of using 'infile' would apply to text files not Excel files.&lt;/P&gt;
&lt;P&gt;If you convert your Excel files to PRN files it would be exactly like your previously mentioned code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What version of SAS were you working on before that makes UE so different? The only difference is how you reference files, and if you worked in a server based environment that's not even significantly different.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If EG, consider using the Visual Programmer mode for a more familiar interface.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Dec 2016 05:42:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Infile-and-snippet-issues-SAS-University/m-p/319782#M1660</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-18T05:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: Infile and snippet issues - SAS University</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Infile-and-snippet-issues-SAS-University/m-p/319805#M1661</link>
      <description>&lt;P&gt;Thanks! That helped.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Dec 2016 17:00:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Infile-and-snippet-issues-SAS-University/m-p/319805#M1661</guid>
      <dc:creator>vicdicenzo</dc:creator>
      <dc:date>2016-12-18T17:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: Infile and snippet issues - SAS University</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Infile-and-snippet-issues-SAS-University/m-p/319809#M1662</link>
      <description>&lt;P&gt;Great to hear! Please mark the question as solved.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind Regards,&lt;/P&gt;
&lt;P&gt;Michelle&lt;/P&gt;</description>
      <pubDate>Sun, 18 Dec 2016 18:11:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Infile-and-snippet-issues-SAS-University/m-p/319809#M1662</guid>
      <dc:creator>MichelleHomes</dc:creator>
      <dc:date>2016-12-18T18:11:01Z</dc:date>
    </item>
  </channel>
</rss>

