<?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: defining af new variable in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/defining-af-new-variable/m-p/734676#M9932</link>
    <description>The problem was that the daye was numeric.&lt;BR /&gt;also. We are creating these to avoid problems when merging dataset. . each new variable will contain the cost for that periode. If we do not do that a lot of the costs disapear when we are merging patient ID. Hens we are not creating a new variabel with a date, the variable with the date will persist. we are creating variables with cost per month.</description>
    <pubDate>Fri, 16 Apr 2021 08:40:49 GMT</pubDate>
    <dc:creator>Jannie_D</dc:creator>
    <dc:date>2021-04-16T08:40:49Z</dc:date>
    <item>
      <title>defining af new variable</title>
      <link>https://communities.sas.com/t5/SAS-Studio/defining-af-new-variable/m-p/734178#M9929</link>
      <description>&lt;P&gt;Hi. I am about to define a couple of new variables.I am working on a secure drive and can not copy paste my data or log.&lt;/P&gt;&lt;P&gt;I just does not work as intended. There are no errors or warnings in the log. But the data does not show up in the intended column.&lt;/P&gt;&lt;P&gt;So I want to create two new variables:&lt;/P&gt;&lt;P&gt;1: DRGambjan2014: which is the variable V_pris_genop if the date in d_hendto is jan and 2014&lt;/P&gt;&lt;P&gt;2:DRGambjun2014:&amp;nbsp;which is the variable V_pris_genop if the date in d_hendto is jun and 2014&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my code lookes like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data DRG1;&lt;/P&gt;&lt;P&gt;set DRG;&lt;/P&gt;&lt;P&gt;if year(d_hendto)=2014 and month(d_hendto)=jan then DRGambjan2014=v_pris_genop;&lt;/P&gt;&lt;P&gt;if year(d_hendto)=2014 and month(d_hendto)=jun then DRGambjun2014=v_pris_genop;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it shows up as if data is missing, even where it is not.&lt;/P&gt;&lt;P&gt;why does it not work?&lt;/P&gt;&lt;P&gt;kind regards Jannie&lt;/P&gt;&lt;P&gt;kind regards&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 10:27:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/defining-af-new-variable/m-p/734178#M9929</guid>
      <dc:creator>Jannie_D</dc:creator>
      <dc:date>2021-04-15T10:27:56Z</dc:date>
    </item>
    <item>
      <title>Re: defining af new variable</title>
      <link>https://communities.sas.com/t5/SAS-Studio/defining-af-new-variable/m-p/734195#M9930</link>
      <description>&lt;P&gt;Show us a typical value of variable d_hendto. Is it numeric or character according to PROC CONTENTS? What format is applied to it according to PROC CONTENTS?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This line:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if year(d_hendto)=2014 and month(d_hendto)=jan then DRGambjan2014=v_pris_genop;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;probably won't work because the second comparison &lt;FONT face="courier new,courier"&gt;month(d_hendto)=jan&lt;/FONT&gt; tests to see if the value of month(d_hendto) is equal to the value of the variable JAN. Does your LOG indicate variable JAN is uninitialized?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 11:31:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/defining-af-new-variable/m-p/734195#M9930</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-04-15T11:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: defining af new variable</title>
      <link>https://communities.sas.com/t5/SAS-Studio/defining-af-new-variable/m-p/734287#M9931</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/359624"&gt;@Jannie_D&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi. I am about to define a couple of new variables.I am working on a secure drive and can not copy paste my data or log.&lt;/P&gt;
&lt;P&gt;I just does not work as intended. There are no errors or warnings in the log. But the data does not show up in the intended column.&lt;/P&gt;
&lt;P&gt;So I want to create two new variables:&lt;/P&gt;
&lt;P&gt;1: DRGambjan2014: which is the variable V_pris_genop if the date in d_hendto is jan and 2014&lt;/P&gt;
&lt;P&gt;2:DRGambjun2014:&amp;nbsp;which is the variable V_pris_genop if the date in d_hendto is jun and 2014&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your creation of variables with names like DRGambjun2014 means that you are placing data, year and month, into a variable name and is generally a poor idea. 90% plus of uses it is going to be better to leave a separate date variable as you currently have it. How do you expect to use the DRGambjun2014 and related variables?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;my code lookes like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data DRG1;&lt;/P&gt;
&lt;P&gt;set DRG;&lt;/P&gt;
&lt;P&gt;if year(d_hendto)=2014 and month(d_hendto)=jan then DRGambjan2014=v_pris_genop;&lt;/P&gt;
&lt;P&gt;if year(d_hendto)=2014 and month(d_hendto)=jun then DRGambjun2014=v_pris_genop;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it shows up as if data is missing, even where it is not.&lt;/P&gt;
&lt;P&gt;why does it not work?&lt;/P&gt;
&lt;P&gt;kind regards Jannie&lt;/P&gt;
&lt;P&gt;kind regards&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The MONTH function returns a numeric value of 1 to 12. If you do not have a variable named Jan then this bit:&lt;/P&gt;
&lt;P&gt;month(d_hendto)=jan&lt;/P&gt;
&lt;P&gt;would likely mean that your log shows something like&lt;/P&gt;
&lt;PRE&gt;NOTE: Variable jan is uninitialized.
&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Apr 2021 14:17:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/defining-af-new-variable/m-p/734287#M9931</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-15T14:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: defining af new variable</title>
      <link>https://communities.sas.com/t5/SAS-Studio/defining-af-new-variable/m-p/734676#M9932</link>
      <description>The problem was that the daye was numeric.&lt;BR /&gt;also. We are creating these to avoid problems when merging dataset. . each new variable will contain the cost for that periode. If we do not do that a lot of the costs disapear when we are merging patient ID. Hens we are not creating a new variabel with a date, the variable with the date will persist. we are creating variables with cost per month.</description>
      <pubDate>Fri, 16 Apr 2021 08:40:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/defining-af-new-variable/m-p/734676#M9932</guid>
      <dc:creator>Jannie_D</dc:creator>
      <dc:date>2021-04-16T08:40:49Z</dc:date>
    </item>
  </channel>
</rss>

