<?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 Error in &amp;quot;where clause&amp;quot; for date in PROC REG in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Error-in-quot-where-clause-quot-for-date-in-PROC-REG/m-p/665217#M19362</link>
    <description>&lt;P&gt;Hello there,&lt;/P&gt;
&lt;P&gt;I am facing an error issue while running the PROC REG. My dataset(attached) named DSET1 have the following structure of rows and columns: ID, DATE Y and X with the format: &lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Capture1.JPG" style="width: 398px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46679i24138CCEB35AE94E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture1.JPG" alt="Capture1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have inserted the code and the full log here. I need help to run the regression for my dataset that contains data from Jan1990 - Dec2019 for each ID.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/** Import an XLSX file.  **/

PROC IMPORT DATAFILE="H:\DSET1.xlsx\"
		    OUT=WORK.dset1
		    DBMS=XLSX
		    REPLACE;
RUN;

/** Print the results. **/

PROC PRINT DATA=WORK.dset1; RUN;


/** SortedIn ID &amp;amp; Date order**/
proc sort data=WORK.dset1 out=temp;
by id date;
run;


/** list of variables and attributes **/

Proc Contents data=work.temp;
run;

/** Estimate coefficients for each ID **/

proc reg noprint data=temp outest=regout1 edf ;
	where Date between ‘01JAN2020’d and ‘31DEC1989’d;
 	model y = x;
 	by id;
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt; 
 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         /** Import an XLSX file.  **/
 74         
 75         PROC IMPORT DATAFILE="H:\Paper 3 SAS - Single Share Class\SAS MAcro help docs\DSET1.xlsx\"
 76             OUT=WORK.dset1
 77             DBMS=XLSX
 78             REPLACE;
 79         RUN;
 
 NOTE: One or more variables were converted because the data type is not supported by the V9 engine. 
       For more details, run with options MSGLEVEL=I.
 NOTE: The import data set has 1800 observations and 4 variables.
 NOTE: WORK.DSET1 data set was successfully created.
 NOTE: PROCEDURE IMPORT used (Total process time):
       real time           0.11 seconds
       cpu time            0.06 seconds
       

 
 80         
 81         /** Print the results. **/
 82         
 83         PROC PRINT DATA=WORK.dset1; RUN;
 
 NOTE: There were 1800 observations read from the data set WORK.DSET1.
 NOTE: PROCEDURE PRINT used (Total process time):
       real time           2.22 seconds
       cpu time            2.18 seconds
       

 
 84         
 85         /** SortedIn ID &amp;amp; Date order**/
 86         proc sort data=WORK.dset1 out=temp;
 87         by id date;
 88         run;
 
 NOTE: There were 1800 observations read from the data set WORK.DSET1.
 NOTE: The data set WORK.TEMP has 1800 observations and 4 variables.
 NOTE: PROCEDURE SORT used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 89         
 90         /** Estimate coefficients for each ID **/
 91         
 92         proc reg noprint data=temp outest=regout1 edf ;
 93         where Date between ‘01JAN2020’d and ‘31DEC1989’d;
                                _
                                22
                                76
 ERROR: Syntax error while parsing WHERE clause.
 ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, 
               a numeric constant, a datetime constant, a missing value, (, +, -, INPUT, NOT, PUT, ^, 
               ~.  
 ERROR 76-322: Syntax error, statement will be ignored.
 94          model y = x;
 95          by id;
 96         run;
 
 WARNING: RUN statement ignored due to previous errors. Submit QUIT; to terminate the procedure.
 NOTE: PROCEDURE REG used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 NOTE: The SAS System stopped processing this step because of errors.
 WARNING: The data set WORK.REGOUT1 may be incomplete.  When this step was stopped there were 0 
          observations and 0 variables.
 WARNING: Data set WORK.REGOUT1 was not replaced because this step was stopped.
 97         
 98         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 111        


&lt;/PRE&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Sara&lt;/P&gt;</description>
    <pubDate>Fri, 26 Jun 2020 01:23:49 GMT</pubDate>
    <dc:creator>saraphdnz</dc:creator>
    <dc:date>2020-06-26T01:23:49Z</dc:date>
    <item>
      <title>Error in "where clause" for date in PROC REG</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Error-in-quot-where-clause-quot-for-date-in-PROC-REG/m-p/665217#M19362</link>
      <description>&lt;P&gt;Hello there,&lt;/P&gt;
&lt;P&gt;I am facing an error issue while running the PROC REG. My dataset(attached) named DSET1 have the following structure of rows and columns: ID, DATE Y and X with the format: &lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Capture1.JPG" style="width: 398px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46679i24138CCEB35AE94E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture1.JPG" alt="Capture1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have inserted the code and the full log here. I need help to run the regression for my dataset that contains data from Jan1990 - Dec2019 for each ID.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/** Import an XLSX file.  **/

PROC IMPORT DATAFILE="H:\DSET1.xlsx\"
		    OUT=WORK.dset1
		    DBMS=XLSX
		    REPLACE;
RUN;

/** Print the results. **/

PROC PRINT DATA=WORK.dset1; RUN;


/** SortedIn ID &amp;amp; Date order**/
proc sort data=WORK.dset1 out=temp;
by id date;
run;


/** list of variables and attributes **/

Proc Contents data=work.temp;
run;

/** Estimate coefficients for each ID **/

proc reg noprint data=temp outest=regout1 edf ;
	where Date between ‘01JAN2020’d and ‘31DEC1989’d;
 	model y = x;
 	by id;
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt; 
 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         /** Import an XLSX file.  **/
 74         
 75         PROC IMPORT DATAFILE="H:\Paper 3 SAS - Single Share Class\SAS MAcro help docs\DSET1.xlsx\"
 76             OUT=WORK.dset1
 77             DBMS=XLSX
 78             REPLACE;
 79         RUN;
 
 NOTE: One or more variables were converted because the data type is not supported by the V9 engine. 
       For more details, run with options MSGLEVEL=I.
 NOTE: The import data set has 1800 observations and 4 variables.
 NOTE: WORK.DSET1 data set was successfully created.
 NOTE: PROCEDURE IMPORT used (Total process time):
       real time           0.11 seconds
       cpu time            0.06 seconds
       

 
 80         
 81         /** Print the results. **/
 82         
 83         PROC PRINT DATA=WORK.dset1; RUN;
 
 NOTE: There were 1800 observations read from the data set WORK.DSET1.
 NOTE: PROCEDURE PRINT used (Total process time):
       real time           2.22 seconds
       cpu time            2.18 seconds
       

 
 84         
 85         /** SortedIn ID &amp;amp; Date order**/
 86         proc sort data=WORK.dset1 out=temp;
 87         by id date;
 88         run;
 
 NOTE: There were 1800 observations read from the data set WORK.DSET1.
 NOTE: The data set WORK.TEMP has 1800 observations and 4 variables.
 NOTE: PROCEDURE SORT used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 89         
 90         /** Estimate coefficients for each ID **/
 91         
 92         proc reg noprint data=temp outest=regout1 edf ;
 93         where Date between ‘01JAN2020’d and ‘31DEC1989’d;
                                _
                                22
                                76
 ERROR: Syntax error while parsing WHERE clause.
 ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, 
               a numeric constant, a datetime constant, a missing value, (, +, -, INPUT, NOT, PUT, ^, 
               ~.  
 ERROR 76-322: Syntax error, statement will be ignored.
 94          model y = x;
 95          by id;
 96         run;
 
 WARNING: RUN statement ignored due to previous errors. Submit QUIT; to terminate the procedure.
 NOTE: PROCEDURE REG used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 NOTE: The SAS System stopped processing this step because of errors.
 WARNING: The data set WORK.REGOUT1 may be incomplete.  When this step was stopped there were 0 
          observations and 0 variables.
 WARNING: Data set WORK.REGOUT1 was not replaced because this step was stopped.
 97         
 98         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 111        


&lt;/PRE&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Sara&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jun 2020 01:23:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Error-in-quot-where-clause-quot-for-date-in-PROC-REG/m-p/665217#M19362</guid>
      <dc:creator>saraphdnz</dc:creator>
      <dc:date>2020-06-26T01:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: Error in "where clause" for date in PROC REG</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Error-in-quot-where-clause-quot-for-date-in-PROC-REG/m-p/665218#M19363</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where Date between ‘01JAN2020’d and ‘31DEC1989’d;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Your date constants are inside left and right quote marks.&amp;nbsp; Put them inside regular straight quotation marks.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jun 2020 01:29:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Error-in-quot-where-clause-quot-for-date-in-PROC-REG/m-p/665218#M19363</guid>
      <dc:creator>JackHamilton</dc:creator>
      <dc:date>2020-06-26T01:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: Error in "where clause" for date in PROC REG</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Error-in-quot-where-clause-quot-for-date-in-PROC-REG/m-p/665239#M19364</link>
      <description>&lt;P&gt;Thanks, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13901"&gt;@JackHamilton&lt;/a&gt;&amp;nbsp;for pointing out this, much appreciated.&amp;nbsp; Regards,Sara&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jun 2020 04:22:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Error-in-quot-where-clause-quot-for-date-in-PROC-REG/m-p/665239#M19364</guid>
      <dc:creator>saraphdnz</dc:creator>
      <dc:date>2020-06-26T04:22:22Z</dc:date>
    </item>
  </channel>
</rss>

