<?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: Problem creating new variables while keeping existing variables in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Problem-creating-new-variables-while-keeping-existing-variables/m-p/337559#M1977</link>
    <description>&lt;P&gt;Thank you so much ! It worked! &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 02 Mar 2017 20:44:21 GMT</pubDate>
    <dc:creator>LMP</dc:creator>
    <dc:date>2017-03-02T20:44:21Z</dc:date>
    <item>
      <title>Problem creating new variables while keeping existing variables</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Problem-creating-new-variables-while-keeping-existing-variables/m-p/337526#M1974</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; I have been trying to create new variables in a&amp;nbsp;dataset that I exported into SAS studio UE. I have tried this multiple times. Everytime, I try to create new variables it deletes the existing variables, and there are blanks in the columns of the new variables I tried to create. I have been trying to create new variables regarding age at a particular event. I have tried this multiple ways; however, I still end up getting a period( (.) which means&amp;nbsp;blank in SAS) &amp;nbsp;in the one row for&amp;nbsp;each variable. Also, none of the previous dataset information appears in the output after running this step; thus, I tried to add a Keep var &amp;nbsp;statement. &amp;nbsp;Prior to running this step I run the Libname and&amp;nbsp;DATA set statement.&amp;nbsp;I provided screen shots of my last coding attempt.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can any one assist or give any kind of advice?&amp;nbsp; If so, I would greatly appreciate it!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;LMP&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG title="Capture 1 sas code.PNG" alt="Capture 1 sas code.PNG" src="https://communities.sas.com/t5/image/serverpage/image-id/7530i3FBB369829DF6629/image-size/original?v=1.0&amp;amp;px=-1" border="0" /&gt;&lt;IMG title="Capture 2 sas.PNG" alt="Capture 2 sas.PNG" src="https://communities.sas.com/t5/image/serverpage/image-id/7531i8E2CC3E33C31B522/image-size/original?v=1.0&amp;amp;px=-1" border="0" /&gt;&lt;IMG title="Capture 3 SAS code.PNG" alt="Capture 3 SAS code.PNG" src="https://communities.sas.com/t5/image/serverpage/image-id/7532i5DAD24C6C97D9E95/image-size/original?v=1.0&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 19:40:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Problem-creating-new-variables-while-keeping-existing-variables/m-p/337526#M1974</guid>
      <dc:creator>LMP</dc:creator>
      <dc:date>2017-03-02T19:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: Problem creating new variables while keeping existing variables</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Problem-creating-new-variables-while-keeping-existing-variables/m-p/337541#M1975</link>
      <description>&lt;P&gt;1) I don't see a SET statement in your code on the second data step. So&amp;nbsp;instead of bringing data in from an existing set you are creating a new one with all missing values for the variables in the KEEP statements.. Try:&lt;/P&gt;
&lt;PRE&gt;data mydata.temp;
   set mydata.bllcinckids2014;
&lt;/PRE&gt;
&lt;P&gt;and add you calculations to that data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) Your syntax for YRDIF is incorrect. You likely want age = yrdif(dob, sampledate,'ACT/ACT'); the Earlier date should be referenced first and YRDIF requires the basis argument of ACT/ACT or the 360 365 variants. Your code should have thrown many error messages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) ALL variables are kept by default. Drop may be easier to use. Note that you can use variable lists to shorten the code:&lt;/P&gt;
&lt;P&gt;Keep Result: ; would keep all of the variables whose names start with Result (note that there is a : at the end)&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;Drop Result: ; would remove all of the result variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4) Many times when there are so many variables with indexed names such as Result, Test Sampledate and so on it indicates that the data structure may be incorrect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;5) Post LOG results when you get errors. And copy/paste Code using the forum {i} menu icon. Noone is going to retype code from a picture to test the results.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 20:12:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Problem-creating-new-variables-while-keeping-existing-variables/m-p/337541#M1975</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-03-02T20:12:27Z</dc:date>
    </item>
    <item>
      <title>Re: Problem creating new variables while keeping existing variables</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Problem-creating-new-variables-while-keeping-existing-variables/m-p/337547#M1976</link>
      <description>Thank you! I will try this out!</description>
      <pubDate>Thu, 02 Mar 2017 20:21:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Problem-creating-new-variables-while-keeping-existing-variables/m-p/337547#M1976</guid>
      <dc:creator>LMP</dc:creator>
      <dc:date>2017-03-02T20:21:14Z</dc:date>
    </item>
    <item>
      <title>Re: Problem creating new variables while keeping existing variables</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Problem-creating-new-variables-while-keeping-existing-variables/m-p/337559#M1977</link>
      <description>&lt;P&gt;Thank you so much ! It worked! &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 20:44:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Problem-creating-new-variables-while-keeping-existing-variables/m-p/337559#M1977</guid>
      <dc:creator>LMP</dc:creator>
      <dc:date>2017-03-02T20:44:21Z</dc:date>
    </item>
  </channel>
</rss>

