<?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: 'ERROR 79-322: Expecting a (.'   Don't understand in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-Don-t-understand/m-p/793415#M254308</link>
    <description>&lt;P&gt;This is one time I would suggest running Proc Import on your CSV file. The LOG will show the data step code to read the file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that unless you have the option validvarname=any; set then variable names can only start with a letter or underscore character and contain letters, the underscore or digits. No spaces ( )&amp;nbsp; or other characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The INPUT statement does use ( and ) but that relates to instruction on how to read a group of variables and your posted code does mean those rules.&lt;/P&gt;
&lt;P&gt;Start with these two documentation pages for the input statement:&lt;BR /&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/lestmtsref/n0oaql83drile0n141pdacojq97s.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/lestmtsref/n0oaql83drile0n141pdacojq97s.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/lestmtsref/n0lrz3gb7m9e4rn137op544ddg0v.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/lestmtsref/n0lrz3gb7m9e4rn137op544ddg0v.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best practice on the forum is to copy the text from the log then on the forum open a text box with the &amp;lt;/&amp;gt; icon and paste the text. The diagnostic characters that would appear with this, and my other characters, then appear in the correct position in relation to the code where the main message window has reformatted the text.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Question: Why would want to read median or average values as character? That doesn't make sense for modeling or further analysis in most forms.&lt;/P&gt;</description>
    <pubDate>Mon, 31 Jan 2022 01:01:09 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-01-31T01:01:09Z</dc:date>
    <item>
      <title>'ERROR 79-322: Expecting a (.'   Don't understand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-Don-t-understand/m-p/793364#M254278</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wondering if someone can help? (Using SAS OnDemand for Academics)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to create a dataset in SAS. This is the code I have:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DATA BI.Portcalls2018;&lt;BR /&gt;	infile '/home/u57411980/sas/Portcalls2018.csv' dlm=',';&lt;BR /&gt;	input  Country :$10. Ship Type :$32. Median time in port (days) :$4. Average age of vessels :$2. Average size (GT) of vessels :$5. Maximum size (GT) of vessels :$5. Average cargo carrying capacity :$5. 	Maximum cargo carrying capacity :$5. Average container carrying capac :$4. Maximum container carrying capac :$4. ;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc print DATA=BI.Portcalls2018;&lt;BR /&gt;run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then hit run and check the Log and I get these errors, which I don't understand:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class=""&gt;68&lt;/DIV&gt;&lt;DIV class=""&gt;69 DATA BI.Portcalls2018;&lt;/DIV&gt;&lt;DIV class=""&gt;70 infile '/home/u57411980/sas/Portcalls2018.csv' dlm=',';&lt;/DIV&gt;&lt;DIV class=""&gt;71 input Country :$10. Ship Type :$32. Median time in port (days) :$4. Average age of vessels :$2. Average size (GT) of&lt;/DIV&gt;&lt;DIV class=""&gt;_ __&lt;/DIV&gt;&lt;DIV class=""&gt;79 79&lt;/DIV&gt;&lt;DIV class=""&gt;76&lt;/DIV&gt;&lt;DIV class=""&gt;ERROR 79-322: Expecting a (.&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;71 ! input Country :$10. Ship Type :$32. Median time in port (days) :$4. Average age of vessels :$2. Average size (GT) of&lt;/DIV&gt;&lt;DIV class=""&gt;___&lt;/DIV&gt;&lt;DIV class=""&gt;79&lt;/DIV&gt;&lt;DIV class=""&gt;71 ! vessels :$5. Maximum size (GT) of vessels :$5. Average cargo carrying capacity :$5. Maximum cargo carrying capacity :$5.&lt;/DIV&gt;&lt;DIV class=""&gt;71 ! Average container carrying capac :$4. Maximum container carrying capac :$4. ;&lt;/DIV&gt;&lt;DIV class=""&gt;ERROR 79-322: Expecting a ).&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;72 run;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/DIV&gt;&lt;DIV class=""&gt;WARNING: The data set BI.PORTCALLS2018 may be incomplete. When this step was stopped there were 0 observations and 13 variables.&lt;/DIV&gt;&lt;DIV class=""&gt;WARNING: Data set BI.PORTCALLS2018 was not replaced because this step was stopped.&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;Does anyone understand what I've done wrong?&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;Thank you&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Jan 2022 13:57:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-Don-t-understand/m-p/793364#M254278</guid>
      <dc:creator>LucarioGeorge24</dc:creator>
      <dc:date>2022-01-30T13:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: 'ERROR 79-322: Expecting a (.'   Don't understand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-Don-t-understand/m-p/793365#M254279</link>
      <description>&lt;P&gt;How many columns are in the CSV file?&lt;/P&gt;
&lt;P&gt;Your current code is attempting to read 38 variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input
  Country :$10. 
  Ship 
  Type :$32. 
  Median 
  time 
  in 
  port 
  (days) :$4. 
  Average 
  age 
  of 
  vessels :$2. 
  Average 
  size 
  (GT) 
  of 
  vessels :$5. 
  Maximum 
  size 
  (GT) 
  of 
  vessels :$5. 
  Average 
  cargo 
  carrying 
  capacity :$5. 	
  Maximum 
  cargo 
  carrying 
  capacity :$5. 
  Average 
  container 
  carrying 
  capac :$4. 
  Maximum 
  container 
  carrying 
  capac :$4. 
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You seem to be trying to use LABELS as NAMES for the variables.&amp;nbsp;Use the NAMES of the variables in the INPUT statement.&amp;nbsp; You can then use a LABEL statement to attach those long descriptive strings (which will be cumbersome at best to use as names) to the variables as the LABEL of the variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The specific error in your INPUT statement that SAS is flagging is the missing &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/p0f9yk6pd4znukn1rlw6hzkg1url.htm#n0th4s9u2hx756n1cojj31alypnt" target="_self"&gt;format group following the variable group&lt;/A&gt;&amp;nbsp;because you include some variable names, like days or GT, in parenthesis.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Other mistakes include not using the DSD and TRUNCOVER option on the INFILE statement. The first will make sure that quoted and empty values are processed properly.&amp;nbsp; The later will prevent SAS from moving to a new line if any line does not have values for all of the variables being read by the INPUT statement.&lt;/P&gt;</description>
      <pubDate>Sun, 30 Jan 2022 15:45:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-Don-t-understand/m-p/793365#M254279</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-01-30T15:45:55Z</dc:date>
    </item>
    <item>
      <title>Re: 'ERROR 79-322: Expecting a (.'   Don't understand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-Don-t-understand/m-p/793415#M254308</link>
      <description>&lt;P&gt;This is one time I would suggest running Proc Import on your CSV file. The LOG will show the data step code to read the file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that unless you have the option validvarname=any; set then variable names can only start with a letter or underscore character and contain letters, the underscore or digits. No spaces ( )&amp;nbsp; or other characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The INPUT statement does use ( and ) but that relates to instruction on how to read a group of variables and your posted code does mean those rules.&lt;/P&gt;
&lt;P&gt;Start with these two documentation pages for the input statement:&lt;BR /&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/lestmtsref/n0oaql83drile0n141pdacojq97s.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/lestmtsref/n0oaql83drile0n141pdacojq97s.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/lestmtsref/n0lrz3gb7m9e4rn137op544ddg0v.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/lestmtsref/n0lrz3gb7m9e4rn137op544ddg0v.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best practice on the forum is to copy the text from the log then on the forum open a text box with the &amp;lt;/&amp;gt; icon and paste the text. The diagnostic characters that would appear with this, and my other characters, then appear in the correct position in relation to the code where the main message window has reformatted the text.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Question: Why would want to read median or average values as character? That doesn't make sense for modeling or further analysis in most forms.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 01:01:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-Don-t-understand/m-p/793415#M254308</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-01-31T01:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: 'ERROR 79-322: Expecting a (.'   Don't understand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-Don-t-understand/m-p/793416#M254309</link>
      <description>&lt;P&gt;A variable that doesn't fully comply with &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lepg/n1m3fal4mygiy0n1fvq8v5ax2jfn.htm" target="_self"&gt;SAS naming standards&lt;/A&gt; must be treated as a SAS name literal and can only get referenced using syntax:&lt;/P&gt;
&lt;P&gt;'&amp;lt;name literal&amp;gt;'n&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The first non-compliant variable in your list is&amp;nbsp;&lt;EM&gt;Ship Type&lt;/EM&gt;. Because there is a blank you can only use such a name as literal via syntax: 'Ship Type'n&lt;/P&gt;
&lt;P&gt;Right now the SAS compiler will interpret these two terms as two variable: Ship and Type&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The next non-compliant variable is&amp;nbsp;&lt;EM&gt;Median time in port &lt;FONT color="#FF0000"&gt;(&lt;/FONT&gt;days)&lt;/EM&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Up to the bracket the SAS compiler will interpret each term as a variable and that's why the compiler only throws an error when it encounters the opening bracket as this is invalid syntax in any case.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As long as your names don't exceed 32 characters you could use SAS name literals. It's not really recommended though as using such variable names in code is just harder and cumbersome.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 09:33:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-Don-t-understand/m-p/793416#M254309</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-01-31T09:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: 'ERROR 79-322: Expecting a (.'   Don't understand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-Don-t-understand/m-p/793442#M254327</link>
      <description>&lt;P&gt;Normally, SAS does not support variable names that have blanks and special characters like parantheses in them. If you need to do that, you will have to set the option VALIDVARNAME=ANY, and use a special syntax to refer to the names, like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA BI.Portcalls2018;
	infile '/home/u57411980/sas/Portcalls2018.csv' dlm=',';
	input  Country :$10. 'Ship Type'n :$32. 'Median time in port (days)'n :$4. 'Average age of vessels'n :$2. 'Average size (GT) of vessels'n :$5. 'Maximum size (GT) of vessels'n :$5. 'Average cargo carrying capacity'n :$5. 	'Maximum cargo carrying capacity'n :$5. 'Average container carrying capac'n :$4. 'Maximum container carrying capac'n :$4. ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And you will then have to refer to them that way all the time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another possibility is to use the long names as variable labels, and use shorter name for the actual variables, e.g.:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA BI.Portcalls2018;
	infile '/home/u57411980/sas/Portcalls2018.csv' dlm=',';
	input  Country :$10. Ship_Type :$32. Days_in_port :$4. ....
       label
         Ship_type='Ship Type'
         Days_in_port='Median time in port (days)'
         ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then you can use the shorter names in your programs, and get the long names in PROC PRINT etc.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 09:38:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-79-322-Expecting-a-Don-t-understand/m-p/793442#M254327</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2022-01-31T09:38:34Z</dc:date>
    </item>
  </channel>
</rss>

