<?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: Formating variables in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Formating-variables/m-p/838991#M36316</link>
    <description>&lt;P&gt;Skipping the parts that look like they are working let's just look at the actual mistake.&lt;/P&gt;
&lt;PRE&gt;198  proc print data=fit1(obs=5);
199  var dob dov CSfmt. txfmt.;
                 ------
                 22
                 201
ERROR 22-322: Syntax error, expecting one of the following: a name, ;, -, /, :, _ALL_, _CHARACTER_,
              _CHAR_, _NUMERIC_.
ERROR 201-322: The option is not recognized and will be ignored.
200  run;&lt;/PRE&gt;
&lt;P&gt;You cannot specify a format in the middle of the VAR statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also you probably do not want to list the same variable, dob, twice in the VAR statement. That will just produce the some information twice in the printout.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want PROC PRINT to use different formats than those already attached to the variables add a FORMAT statement.&lt;/P&gt;
&lt;P&gt;The syntax for a FORMAT is statement is a series of variable names followed by the formats to attach to them.&amp;nbsp; &amp;nbsp;You can list one or more variables followed by one format specification, and you can do this multiple times in one FORMAT statement if you want.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to just remove any formats that might already be attached from a set of variables then do not include the format specification.&amp;nbsp; This list of variables must be the last list in the FORMAT statement for obvious reasons.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 17 Oct 2022 14:52:02 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-10-17T14:52:02Z</dc:date>
    <item>
      <title>Formating variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Formating-variables/m-p/838986#M36313</link>
      <description>&lt;P&gt;I don't understand my I keep getting this error message.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;libname hw4 '\\apporto.com\dfs\GWU\Users\kennedyhinnant_gwu\Downloads\Assignment 4';
data fit1;
set hw4.fit1;
run;
*Question (i-iv);
proc format; 
value CSfmt 1 = 'Current Smokers' 0 = 'Nonsmokers';
value txfmt 1 = "treatment" 0 = "Placebo";
value bmifmt 25-HIGH ="overweight" LOW -&amp;lt; 25="normal";
value bmigrp LOW -&amp;lt; 18= 'underweight' 18 - 25 = 'normal' 25 &amp;lt;- HIGH = 'normal';
run;
proc means data =fit1 p25; 
*Quesition 1(v-vi);
proc format; 
value cobmdfmt 0.545-HIGH = 'Above';
value blbmdfmt LOW -&amp;lt; 0.542 = 'less'; 
run;
data fit1tmp;
set hw4.fit1;
run;
*Question 1 (cii); 
proc print data=fit1(obs=5);
var dob dov;
format dob dov mmddyy10. smoker CSfmt. tx_status txfmt.;
run;
*Question 1(iii); 
proc print data=fit1(obs=5); 
var dob dov CSfmt. txfmt.; 
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;NOTE: Libref HW4 was successfully assigned as follows:
      Engine:        V9
      Physical Name: \\apporto.com\dfs\GWU\Users\kennedyhinnant_gwu\Downloads\Assignment 4

NOTE: PROCEDURE GLM used (Total process time):
      real time           7:13.34
      cpu time            15.09 seconds


173  data fit1;
174  set hw4.fit1;
175  run;

NOTE: There were 5813 observations read from the data set HW4.FIT1.
NOTE: The data set WORK.FIT1 has 5813 observations and 14 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.00 seconds


176  *Question (i-iv);
177  proc format;
178  value CSfmt 1 = 'Current Smokers' 0 = 'Nonsmokers';
NOTE: Format CSFMT is already on the library WORK.FORMATS.
NOTE: Format CSFMT has been output.
179  value txfmt 1 = "treatment" 0 = "Placebo";
NOTE: Format TXFMT is already on the library WORK.FORMATS.
NOTE: Format TXFMT has been output.
180  value bmifmt 25-HIGH ="overweight" LOW -&amp;lt; 25="normal";
NOTE: Format BMIFMT is already on the library WORK.FORMATS.
NOTE: Format BMIFMT has been output.
181  value bmigrp LOW -&amp;lt; 18= 'underweight' 18 - 25 = 'normal' 25 &amp;lt;- HIGH = 'normal';
NOTE: Format BMIGRP is already on the library WORK.FORMATS.
NOTE: Format BMIGRP has been output.
182  run;

NOTE: PROCEDURE FORMAT used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


183  proc means data =fit1 p25;
184  *Quesition 1(v-vi);

NOTE: There were 5813 observations read from the data set WORK.FIT1.
NOTE: PROCEDURE MEANS used (Total process time):
      real time           0.04 seconds
      cpu time            0.03 seconds


185  proc format;
186  value cobmdfmt 0.545-HIGH = 'Above';
NOTE: Format COBMDFMT is already on the library WORK.FORMATS.
NOTE: Format COBMDFMT has been output.
187  value blbmdfmt LOW -&amp;lt; 0.542 = 'less';
NOTE: Format BLBMDFMT is already on the library WORK.FORMATS.
NOTE: Format BLBMDFMT has been output.
188  run;

NOTE: PROCEDURE FORMAT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


189  data fit1tmp;
190  set hw4.fit1;
191  run;

NOTE: There were 5813 observations read from the data set HW4.FIT1.
NOTE: The data set WORK.FIT1TMP has 5813 observations and 14 variables.
NOTE: DATA statement used (Total process time):
      real time           0.06 seconds
      cpu time            0.01 seconds


192  *Question 1 (cii);
193  proc print data=fit1(obs=5);
194  var dob dov;
195  format dob dov mmddyy10. smoker CSfmt. tx_status txfmt.;
196  run;

NOTE: There were 5 observations read from the data set WORK.FIT1.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


197  *Question 1(iii);
198  proc print data=fit1(obs=5);
199  var dob dov CSfmt. txfmt.;
                 ------
                 22
                 201
ERROR 22-322: Syntax error, expecting one of the following: a name, ;, -, /, :, _ALL_, _CHARACTER_,
              _CHAR_, _NUMERIC_.
ERROR 201-322: The option is not recognized and will be ignored.
200  run;

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=""&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Oct 2022 14:40:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Formating-variables/m-p/838986#M36313</guid>
      <dc:creator>MisterJenn</dc:creator>
      <dc:date>2022-10-17T14:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: Formating variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Formating-variables/m-p/838991#M36316</link>
      <description>&lt;P&gt;Skipping the parts that look like they are working let's just look at the actual mistake.&lt;/P&gt;
&lt;PRE&gt;198  proc print data=fit1(obs=5);
199  var dob dov CSfmt. txfmt.;
                 ------
                 22
                 201
ERROR 22-322: Syntax error, expecting one of the following: a name, ;, -, /, :, _ALL_, _CHARACTER_,
              _CHAR_, _NUMERIC_.
ERROR 201-322: The option is not recognized and will be ignored.
200  run;&lt;/PRE&gt;
&lt;P&gt;You cannot specify a format in the middle of the VAR statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also you probably do not want to list the same variable, dob, twice in the VAR statement. That will just produce the some information twice in the printout.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want PROC PRINT to use different formats than those already attached to the variables add a FORMAT statement.&lt;/P&gt;
&lt;P&gt;The syntax for a FORMAT is statement is a series of variable names followed by the formats to attach to them.&amp;nbsp; &amp;nbsp;You can list one or more variables followed by one format specification, and you can do this multiple times in one FORMAT statement if you want.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to just remove any formats that might already be attached from a set of variables then do not include the format specification.&amp;nbsp; This list of variables must be the last list in the FORMAT statement for obvious reasons.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2022 14:52:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Formating-variables/m-p/838991#M36316</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-10-17T14:52:02Z</dc:date>
    </item>
  </channel>
</rss>

