<?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: New Variable (log) in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Permanent-SAS-dataset/m-p/837738#M36179</link>
    <description>&lt;P&gt;The variable that receives a value appears on the LEFT of the equal sign.&lt;/P&gt;
&lt;P&gt;instead of:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;log(peri) = logperi;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;logperi = log(peri);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Oct 2022 22:28:27 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-10-10T22:28:27Z</dc:date>
    <item>
      <title>Permanent SAS dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Permanent-SAS-dataset/m-p/837735#M36178</link>
      <description>&lt;P&gt;I am trying to create a new permanent SAS data set with the following variables.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data bone;
infile "\\apporto.com\dfs\GWU\Users\kennedyhinnant_gwu\Downloads\Assignment 4\bone.txt";
input @1 dob 1-10. @11 dov 11-20. @21 wt $ 21-26. @27 ht 27-30. @31 peri $ 31-35. 
	  endo $ 35-40 tibia $ 41-44 tanner 45 sex 46;
age = (dov - dob)/365;
logperi = log(peri);
run;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=""&gt;181  data bone;
182  infile "\\apporto.com\dfs\GWU\Users\kennedyhinnant_gwu\Downloads\Assignment 4\bone.txt";
183  input @1 dob 1-10. @11 dov 11-20. @21 wt $ 21-26. @27 ht 27-30. @31 peri $ 31-35.
                    ---            ---
                    22             22
ERROR: Invalid decimal specification.
183  input @1 dob 1-10. @11 dov 11-20. @21 wt $ 21-26. @27 ht 27-30. @31 peri $ 31-35.
                                                   ---
                                                   22
ERROR 22-322: Expecting an integer constant.

ERROR: The ending column position 1 is before the starting column position 11.
ERROR: Invalid decimal specification.
183  input @1 dob 1-10. @11 dov 11-20. @21 wt $ 21-26. @27 ht 27-30. @31 peri $ 31-35.
                                                                 ---
                                                                 22
ERROR 22-322: Expecting an integer constant.

ERROR: The ending column position 1 is before the starting column position 21.
ERROR: Invalid decimal specification.
ERROR: The ending column position 1 is before the starting column position 27.
ERROR: Invalid decimal specification.
183  input @1 dob 1-10. @11 dov 11-20. @21 wt $ 21-26. @27 ht 27-30. @31 peri $ 31-35.
                                                                                   ---
                                                                                   22
ERROR 22-322: Expecting an integer constant.

184        endo $ 35-40 tibia $ 41-44 tanner 45 sex 46;
ERROR: The ending column position 1 is before the starting column position 31.
ERROR: Invalid decimal specification.
185  age = (dov - dob)/365;
186  logperi = log(peri);
187  run;

NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
      186:15
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.BONE may be incomplete.  When this step was stopped there were 0
         observations and 11 variables.
WARNING: Data set WORK.BONE was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.03 seconds&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;CODE class=""&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 23:04:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Permanent-SAS-dataset/m-p/837735#M36178</guid>
      <dc:creator>MisterJenn</dc:creator>
      <dc:date>2022-10-10T23:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: New Variable (log)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Permanent-SAS-dataset/m-p/837738#M36179</link>
      <description>&lt;P&gt;The variable that receives a value appears on the LEFT of the equal sign.&lt;/P&gt;
&lt;P&gt;instead of:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;log(peri) = logperi;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;logperi = log(peri);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 22:28:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Permanent-SAS-dataset/m-p/837738#M36179</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-10-10T22:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: Permanent SAS dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Permanent-SAS-dataset/m-p/837762#M36183</link>
      <description>&lt;P&gt;You are using &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n13ejk9swz5vrbn0z34iazfrp0wp.htm" target="_self"&gt;column input&lt;/A&gt; which lists the from-to column. This syntax doesn't require a period.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_1-1665450449115.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76065i0F9F72F38C169AEA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_1-1665450449115.png" alt="Patrick_1-1665450449115.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Column input also doesn't require pointer control&amp;nbsp;@&amp;lt;n&amp;gt; because you're defining the start and end columns already explicitly.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_2-1665450649816.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76066i4B106EC6C711226A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_2-1665450649816.png" alt="Patrick_2-1665450649816.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming dob is Date of Birth and in your source data you've got something like &lt;EM&gt;20Mar2001,&lt;/EM&gt; trying to read this string as a number will fail. What you need to do is provide SAS the instruction how to read and convert the source string to a SAS Date value. That's done via an &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/leforinforref/n0verk17pchh4vn1akrrv0b5w3r0.htm" target="_self"&gt;INFORMAT&lt;/A&gt;. Using the appropriate informat will read the source string and convert it into a SAS Date value (count of days since 1/1/1960). Applying a &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/leforinforref/n0p2fmevfgj470n17h4k9f27qjag.htm" target="_self"&gt;FORMAT&lt;/A&gt; will then print this count of days in a human readable form as a date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For a blank delimited source file like...&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_3-1665451716930.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76070iBD90A7CBF55CB30D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_3-1665451716930.png" alt="Patrick_3-1665451716930.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;...code as below would work.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data bone;
  infile "c:\temp\bone.txt" dsd dlm=' ' truncover;
  input dob :date9. dov :date9. wt $ 21-26;
  format dob dov date9.;
  age = yrdif(dob,dov,'age');
  logperi = log(peri);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To calculate the age: Use function yrdif() which handles even leap years.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1665452382348.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76071iB70AC61D8A1BCFB0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1665452382348.png" alt="Patrick_0-1665452382348.png" /&gt;&lt;/span&gt;&lt;BR /&gt;If you want to create a permanent SAS data set that doesn't get automatically deleted after your SAS session ends then you need to a) define a &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsglobal/n1nk65k2vsfmxfn1wu17fntzszbp.htm" target="_self"&gt;libname&lt;/A&gt; that points to permanent storages and b) use a two level name with the libref in your data statement &amp;lt;libref&amp;gt;.&amp;lt;table name&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And last but not least: Lookup the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n1rill4udj0tfun1fvce3j401plo.htm" target="_self"&gt;INFILE&lt;/A&gt; statement and what the highlighted parameters below do for you.&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1665452869953.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76072i6B9121C48F246C5A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1665452869953.png" alt="Patrick_0-1665452869953.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2022 01:49:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Permanent-SAS-dataset/m-p/837762#M36183</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-10-11T01:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: Permanent SAS dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Permanent-SAS-dataset/m-p/837766#M36184</link>
      <description>This code only accounts for wt, age variables. The other variables are now missing data</description>
      <pubDate>Tue, 11 Oct 2022 01:54:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Permanent-SAS-dataset/m-p/837766#M36184</guid>
      <dc:creator>MisterJenn</dc:creator>
      <dc:date>2022-10-11T01:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: Permanent SAS dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Permanent-SAS-dataset/m-p/837772#M36185</link>
      <description>&lt;P&gt;Are you trying to read the data using &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n13ejk9swz5vrbn0z34iazfrp0wp.htm" target="_self"&gt;column mode input&lt;/A&gt;?&lt;/P&gt;
&lt;P&gt;If so why did you also include cursor motion commands?&amp;nbsp; Those are not needed as to start and stop columns are already included.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you trying to have SAS insert an &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n13ejk9swz5vrbn0z34iazfrp0wp.htm#p1mkv39y46aldwn1tya14m1x0tut" target="_self"&gt;implied decimal point&lt;/A&gt; into your numbers?&amp;nbsp; If so then you need to include the number of implied decimal places after the period.&amp;nbsp; If not then why did you include a decimal point after the ending column number?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is PERI supposed to be a numeric value?&amp;nbsp; If so then why did you create it as a character variable by including the $ in the INPUT statement?&amp;nbsp; If not then why are you trying to pass a character string to the LOG() function?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does your source file have the DOV and DOB variables stored as the raw number of days since 1960 ?&amp;nbsp; If so then why would they need 10 columns in the source text file?&amp;nbsp; The value that represents today is 22,928 which only needs 5 characters.&amp;nbsp; And if you have any 120 year olds in your data the value that represents 01JAN1900 is -21,914 which only needs 6 characters including the minus sign.&lt;/P&gt;
&lt;PRE&gt;1247  data _null_;
1248   today=date();
1249   jan1900 = '01JAN1900'd ;
1250   put (_all_) (=comma10./);
1251  run;

today=22,928
jan1900=-21,914
&lt;/PRE&gt;
&lt;P&gt;You probably need to use an informat with the DOV and DOB variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You cannot tell SAS to use an informat when using column mode input.&amp;nbsp; So you will want switch to a hybrid method that uses column mode for most of the variables and formatted mode to handle the two date values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You don't say how the dates are entered so let's assume the 10 character strings in your text file are in a style that the YYMMDD informat can read.&amp;nbsp; So something like 2022-10-10 for example.&amp;nbsp; Then your INPUT statement might look more like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input dob yymmdd10.  dov yymmdd10. wt  21-26  ht 27-30 peri 31-35 
      endo 35-40 tibia 41-44 tanner 45 sex 46
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And you will probably also want to attach a FORMAT to DOB and DOV so that they print in a style that is easier for humans to understand than values like&amp;nbsp;22,928 or&amp;nbsp;-21,914.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;format dob dov yymmdd10.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you really don't know how the dates are represented (or they are inconsistent) then you could try using the ANYDTDTE. informat instead.&amp;nbsp; That will try to guess what type of style the strings are using and adjust.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And if you want to make a PERMANENT dataset then don't want to use a one level dataset name. Instead create a libref that points to some directory on your machine and use a two level name.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname perm "\\apporto.com\dfs\GWU\Users\kennedyhinnant_gwu\Downloads\Assignment 4\";
data perm.bone;
  infile "\\apporto.com\dfs\GWU\Users\kennedyhinnant_gwu\Downloads\Assignment 4\bone.txt" truncover;
  input dob yymmdd10.  dov yymmdd10. wt  21-26  ht 27-30 peri 31-35 
    endo 35-40 tibia 41-44 tanner 45 sex 46
  ;
  format dob dov yymmdd10.;
  age = (dov - dob)/365;
  logperi = log(peri);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2022 02:35:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Permanent-SAS-dataset/m-p/837772#M36185</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-10-11T02:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: Permanent SAS dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Permanent-SAS-dataset/m-p/837773#M36186</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/435394"&gt;@MisterJenn&lt;/a&gt;&amp;nbsp;This is a template for you to do some own work.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2022 02:38:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Permanent-SAS-dataset/m-p/837773#M36186</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-10-11T02:38:47Z</dc:date>
    </item>
  </channel>
</rss>

