<?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: SAS dataset syntax error in data step in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/SAS-dataset-syntax-error-in-data-step/m-p/793057#M32730</link>
    <description>&lt;P&gt;Because you cannot have a dataset LIST there.&amp;nbsp; Spell out the names.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test1 test2 test3 ....&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 28 Jan 2022 03:41:38 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-01-28T03:41:38Z</dc:date>
    <item>
      <title>SAS dataset syntax error in data step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-dataset-syntax-error-in-data-step/m-p/793055#M32729</link>
      <description>&lt;P&gt;Hi all, I get the following syntax error when naming multiple datasets using hyphen in sas and it's very confusing. Could someone please shed some light on why this error comes up? Thanks in advance!&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;5756  data test1-test10;
                -
                22
                200
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, (, /, ;,
              _DATA_, _LAST_, _NULL_.

ERROR 200-322: The symbol is not recognized and will be ignored.

5757      set audiores;
5758      if a=1 and b=1 then output test1;
5759      if a=1 and b=0 then output test2;
                                     -----
                                     455
ERROR 455-185: Data set was not specified on the DATA statement.

5760  run;

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.TEST1 may be incomplete.  When this step was stopped there were 0
         observations and 95 variables.
WARNING: The data set WORK.TEST10 may be incomplete.  When this step was stopped there were 0
         observations and 95 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Jan 2022 03:22:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-dataset-syntax-error-in-data-step/m-p/793055#M32729</guid>
      <dc:creator>Abishekaa</dc:creator>
      <dc:date>2022-01-28T03:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: SAS dataset syntax error in data step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-dataset-syntax-error-in-data-step/m-p/793057#M32730</link>
      <description>&lt;P&gt;Because you cannot have a dataset LIST there.&amp;nbsp; Spell out the names.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test1 test2 test3 ....&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Jan 2022 03:41:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-dataset-syntax-error-in-data-step/m-p/793057#M32730</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-01-28T03:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: SAS dataset syntax error in data step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-dataset-syntax-error-in-data-step/m-p/793060#M32731</link>
      <description>&lt;P&gt;Thank you, Tom! I did not know that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would there be an easier way to list consecutive dataset names? I have to create about 50 output datasets in the program, so the dataset name list would like test1...test50&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 04:13:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-dataset-syntax-error-in-data-step/m-p/793060#M32731</guid>
      <dc:creator>Abishekaa</dc:creator>
      <dc:date>2022-01-28T04:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: SAS dataset syntax error in data step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-dataset-syntax-error-in-data-step/m-p/793071#M32733</link>
      <description>&lt;P&gt;You could use a macro-loop to create the names. But having to create 50 datasets seems to be a bit strange. Why do you need them?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 06:56:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-dataset-syntax-error-in-data-step/m-p/793071#M32733</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-01-28T06:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: SAS dataset syntax error in data step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-dataset-syntax-error-in-data-step/m-p/793088#M32738</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/102730"&gt;@Abishekaa&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you, Tom! I did not know that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would there be an easier way to list consecutive dataset names? I have to create about 50 output datasets in the program, so the dataset name list would like test1...test50&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You code makes me think you might be better served to create a grouping variable with that block of if/then code and then use BY Group processing later.&lt;/P&gt;
&lt;P&gt;Or please describe exactly how you are going to use those 50 data sets later.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 10:16:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-dataset-syntax-error-in-data-step/m-p/793088#M32738</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-01-28T10:16:24Z</dc:date>
    </item>
    <item>
      <title>Re: SAS dataset syntax error in data step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-dataset-syntax-error-in-data-step/m-p/793136#M32740</link>
      <description>&lt;P&gt;Assuming there is a valid reason you need to actually do this then that type of "wallpaper" code is best generated through code generation.&amp;nbsp; In your case it looks like you need a dataset with three variables to drive the code generation.&amp;nbsp; Something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data rules;
  input dsname :$32. a b ;
cards;
test1 1 1
test2 1 0
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You could then use that dataset to create the code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename code temp;
data _null_;
  set rules end=eof;
  file code lrecl=72;
  if _n_=1 then put 'data ' @;
  put dsname @;
  if eof then put / ';' ;
run;
data _null_;
  set rules end=eof;
  file code lrecl=72 mod;
  put @3 'if ' a= 'and ' b= 'then output ' dsname ';' ;
  if eof then put 'run;' ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can then run the generated code using the %INCLUDE statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%include code / source2;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Jan 2022 14:21:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-dataset-syntax-error-in-data-step/m-p/793136#M32740</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-01-28T14:21:32Z</dc:date>
    </item>
  </channel>
</rss>

