<?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: how to add a calculated variable to our code? I want o add a variable which shows num1/ num2, ca in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-calculated-variable-to-our-code-I-want-o-add-a/m-p/739376#M230757</link>
    <description>&lt;P&gt;It can be written as follows.&lt;BR /&gt;(The case where num2 is 0 or missing is not taken into account.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mydate;
   infile datalines dlm=',';
   length 'health plan'n $40 'sub health plan'n $30 'diag code'n $10;
   input 'health plan'n 'sub health plan'n 'diag code'n num1 num2;
   rate=num1/num2;
   datalines;
Marina hills county, Misson plan, 234, 110, 20
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 06 May 2021 00:15:04 GMT</pubDate>
    <dc:creator>japelin</dc:creator>
    <dc:date>2021-05-06T00:15:04Z</dc:date>
    <item>
      <title>how to add a calculated variable to our code? I want o add a variable which shows num1/ num2, call i</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-calculated-variable-to-our-code-I-want-o-add-a/m-p/739372#M230754</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;/*how to add a calculated variable to our code? I want o add a variable which shows num1/ num2, call it rate*/
/* boxes doesn't allow to key in our questions*/

options validvarname=any;

data mydate;
   infile datalines dlm=',';
   length 'health plan'n $40 'sub health plan'n $30 'diag code'n $10;
   input 'health plan'n 'sub health plan'n 'diag code'n num1 num2;
   datalines;
Marina hills county, Misson plan, 234, 110, 20
;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 May 2021 23:59:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-calculated-variable-to-our-code-I-want-o-add-a/m-p/739372#M230754</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-05-05T23:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: how to add a calculated variable to our code? I want o add a variable which shows num1/ num2, ca</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-calculated-variable-to-our-code-I-want-o-add-a/m-p/739376#M230757</link>
      <description>&lt;P&gt;It can be written as follows.&lt;BR /&gt;(The case where num2 is 0 or missing is not taken into account.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mydate;
   infile datalines dlm=',';
   length 'health plan'n $40 'sub health plan'n $30 'diag code'n $10;
   input 'health plan'n 'sub health plan'n 'diag code'n num1 num2;
   rate=num1/num2;
   datalines;
Marina hills county, Misson plan, 234, 110, 20
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 May 2021 00:15:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-calculated-variable-to-our-code-I-want-o-add-a/m-p/739376#M230757</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2021-05-06T00:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to add a calculated variable to our code? I want o add a variable which shows num1/ num2, ca</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-calculated-variable-to-our-code-I-want-o-add-a/m-p/739399#M230773</link>
      <description>&lt;P&gt;Note: don't use name-literals if you are not forced to used them. They are worsening the readability of your code.&lt;/P&gt;</description>
      <pubDate>Thu, 06 May 2021 06:12:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-calculated-variable-to-our-code-I-want-o-add-a/m-p/739399#M230773</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-05-06T06:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: how to add a calculated variable to our code? I want o add a variable which shows num1/ num2, ca</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-calculated-variable-to-our-code-I-want-o-add-a/m-p/739406#M230778</link>
      <description>&lt;P&gt;Don't make your life hard by using those name literals. Use underlines in place of blanks:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mydate;
   infile datalines dlm=',';
   length health_plan $40 sub_health_plan $30 diag_code $10;
   input health_plan sub_health_plan diag_code num1 num2;
   datalines;
Marina hills county, Misson plan, 234, 110, 20
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;See how much easier to read (and type!) that code is?&lt;/P&gt;</description>
      <pubDate>Thu, 06 May 2021 06:56:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-calculated-variable-to-our-code-I-want-o-add-a/m-p/739406#M230778</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-05-06T06:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to add a calculated variable to our code? I want o add a variable which shows num1/ num2, ca</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-calculated-variable-to-our-code-I-want-o-add-a/m-p/739408#M230779</link>
      <description>&lt;P&gt;And the you can improve the readability even more by moving the formats into the INPUT statement, and structure it visually:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mydate;
infile datalines dlm=',';
input
  health_plan :$40.
  sub_health_plan :$30.
  diag_code :$10.
  num1
  num2
;
datalines;
Marina hills county, Misson plan, 234, 110, 20
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Having items on separate lines makes editing the code easier (shuffling items can be done my marking/moving whole lines, which is less work than having to exactly move the cursor to the needed columns within a line).&lt;/P&gt;</description>
      <pubDate>Thu, 06 May 2021 07:03:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-calculated-variable-to-our-code-I-want-o-add-a/m-p/739408#M230779</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-05-06T07:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: how to add a calculated variable to our code? I want o add a variable which shows num1/ num2, ca</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-calculated-variable-to-our-code-I-want-o-add-a/m-p/739538#M230836</link>
      <description>Thanks for the response.&lt;BR /&gt;What is name literals?&lt;BR /&gt;Regards,&lt;BR /&gt;Blue Blue</description>
      <pubDate>Thu, 06 May 2021 15:58:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-calculated-variable-to-our-code-I-want-o-add-a/m-p/739538#M230836</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-05-06T15:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to add a calculated variable to our code? I want o add a variable which shows num1/ num2, ca</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-calculated-variable-to-our-code-I-want-o-add-a/m-p/739540#M230837</link>
      <description>&lt;P&gt;Thanks for the response. I will try to adapt it.&lt;/P&gt;
&lt;P&gt;How to show the calculated field?&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Blue blue&lt;/P&gt;</description>
      <pubDate>Thu, 06 May 2021 16:00:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-calculated-variable-to-our-code-I-want-o-add-a/m-p/739540#M230837</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-05-06T16:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to add a calculated variable to our code? I want o add a variable which shows num1/ num2, ca</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-calculated-variable-to-our-code-I-want-o-add-a/m-p/739579#M230856</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;health_plan&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is a "valid SAS name" (only letters, digits and underlines, does not start with a digit)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;"health plan"n&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is a "name literal", necessary because of the blank.&lt;/P&gt;</description>
      <pubDate>Thu, 06 May 2021 17:32:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-calculated-variable-to-our-code-I-want-o-add-a/m-p/739579#M230856</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-05-06T17:32:52Z</dc:date>
    </item>
    <item>
      <title>Re: how to add a calculated variable to our code? I want o add a variable which shows num1/ num2, ca</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-calculated-variable-to-our-code-I-want-o-add-a/m-p/739624#M230876</link>
      <description>&lt;P&gt;Sometimes,&lt;/P&gt;
&lt;P&gt;We don't have a control over the external world, we might receive a file that has spaces in first observation.&lt;/P&gt;
&lt;P&gt;Thanks for the response.&lt;/P&gt;
&lt;P&gt;Blue blue&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 May 2021 19:26:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-calculated-variable-to-our-code-I-want-o-add-a/m-p/739624#M230876</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-05-06T19:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: how to add a calculated variable to our code? I want o add a variable which shows num1/ num2, ca</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-calculated-variable-to-our-code-I-want-o-add-a/m-p/739630#M230878</link>
      <description>&lt;P&gt;Irrelevant. When reading CSV (or other text) files, you skip the header line with FIRSTOBS=2 and define the variable names in the INPUT statement. Do not use PROC IMPORT.&lt;/P&gt;</description>
      <pubDate>Thu, 06 May 2021 19:50:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-calculated-variable-to-our-code-I-want-o-add-a/m-p/739630#M230878</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-05-06T19:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to add a calculated variable to our code? I want o add a variable which shows num1/ num2, ca</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-calculated-variable-to-our-code-I-want-o-add-a/m-p/739632#M230880</link>
      <description>&lt;P&gt;Read&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226565"&gt;@japelin&lt;/a&gt;&amp;nbsp;'s post.&lt;/P&gt;</description>
      <pubDate>Thu, 06 May 2021 20:01:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-add-a-calculated-variable-to-our-code-I-want-o-add-a/m-p/739632#M230880</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-05-06T20:01:32Z</dc:date>
    </item>
  </channel>
</rss>

