<?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 assign the values of the existing variable to a new variable with modification? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-assign-the-values-of-the-existing-variable-to-a-new/m-p/367521#M87508</link>
    <description>&lt;P&gt;you may need to give a else statement. If you can do not give else statement, then you will get null if scenarious you have mentioned does not cover all the records. you should probably do else varnum = somevalue&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jun 2017 21:52:10 GMT</pubDate>
    <dc:creator>kiranv_</dc:creator>
    <dc:date>2017-06-15T21:52:10Z</dc:date>
    <item>
      <title>How to assign the values of the existing variable to a new variable with modification?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-assign-the-values-of-the-existing-variable-to-a-new/m-p/367514#M87502</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am writting a program and want to assign the values of the existing variable to a new variable with some modification, but have a problem with it. the new variable VISNUMEN has the missing value. Any help is greatly appreciated. the coding is as the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;	if VISITNUM=13 and strip(upcase(DSTERM))='PROTCOL COMPLETED' then VISNUMEN=12;
	else if VISITNUM=12 and strip(upcase(DSTERM))='PROTCOL COMPLETED' then VISNUMEN=VISITNUM;&lt;/PRE&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 21:44:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-assign-the-values-of-the-existing-variable-to-a-new/m-p/367514#M87502</guid>
      <dc:creator>SAS_John</dc:creator>
      <dc:date>2017-06-15T21:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign the values of the existing variable to a new variable with modification?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-assign-the-values-of-the-existing-variable-to-a-new/m-p/367517#M87505</link>
      <description>&lt;P&gt;It has all missing values or some missing values? Are you sure all conditions are being capture by your logic?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The easiest way to check something like this is to use a PROC FREQ with the new and old values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=have;
where strip(upcase(dsterm)) = 'PROTOCOL COMPLETED' ;

table visitnum*visnumen;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Jun 2017 21:49:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-assign-the-values-of-the-existing-variable-to-a-new/m-p/367517#M87505</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-06-15T21:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign the values of the existing variable to a new variable with modification?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-assign-the-values-of-the-existing-variable-to-a-new/m-p/367521#M87508</link>
      <description>&lt;P&gt;you may need to give a else statement. If you can do not give else statement, then you will get null if scenarious you have mentioned does not cover all the records. you should probably do else varnum = somevalue&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 21:52:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-assign-the-values-of-the-existing-variable-to-a-new/m-p/367521#M87508</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-06-15T21:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign the values of the existing variable to a new variable with modification?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-assign-the-values-of-the-existing-variable-to-a-new/m-p/367523#M87509</link>
      <description>&lt;P&gt;Thanks Reeza for the response. Yes, it is all missing values.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 21:59:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-assign-the-values-of-the-existing-variable-to-a-new/m-p/367523#M87509</guid>
      <dc:creator>SAS_John</dc:creator>
      <dc:date>2017-06-15T21:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign the values of the existing variable to a new variable with modification?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-assign-the-values-of-the-existing-variable-to-a-new/m-p/367525#M87510</link>
      <description>&lt;P&gt;Here the coding purpose is to change the vaule of '13' for VISITNUM to the vaule of '12' of VISNUMEN. it seems that this did not work&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 22:02:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-assign-the-values-of-the-existing-variable-to-a-new/m-p/367525#M87510</guid>
      <dc:creator>SAS_John</dc:creator>
      <dc:date>2017-06-15T22:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign the values of the existing variable to a new variable with modification?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-assign-the-values-of-the-existing-variable-to-a-new/m-p/367526#M87511</link>
      <description>&lt;P&gt;1. What does your log say?&lt;/P&gt;
&lt;P&gt;2. What's the type and format of visitnum&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 22:03:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-assign-the-values-of-the-existing-variable-to-a-new/m-p/367526#M87511</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-06-15T22:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign the values of the existing variable to a new variable with modification?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-assign-the-values-of-the-existing-variable-to-a-new/m-p/367529#M87514</link>
      <description>&lt;DIV class="sasSource"&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;55&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;56 data ds;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;57 set sdtm.ds(rename=(DSDECOD=DSDECOD_ DSTERM=DSTERM_));&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;58&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;59 where strip(upcase(DSCAT))='DISPOSITION EVENT';&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;60&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;61 length DCDECOD $27 DCREASCD $50 DISCONFL DSRAEFL $1 VISNUMEN 8.;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;62 DCDECOD=DSDECOD_;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;63 DCREASCD=DSTERM_;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;64&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;65 if strip(upcase(DSDECOD_))^='COMPLETED' then DISCONFL='Y';&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;66 else DISCONFL='';&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;67&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;68 if strip(upcase(DSDECOD_))='ADVERSE EVENT' then DSRAEFL='Y';&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;69 else DSRAEFL='';&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;70&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;71 if VISITNUM=13 and strip(upcase(DSTERM))='PROTCOL COMPLETED' then VISNUMEN=12;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;72 else if VISITNUM=12 and strip(upcase(DSTERM))='PROTCOL COMPLETED' then VISNUMEN=VISITNUM;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;73&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;74 keep USUBJID DCDECOD DCREASCD DISCONFL DSRAEFL DSSTDTC VISNUMEN;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;75 label DCDECOD='Standardized Disposition Term'&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;76 DCREASCD='Reason for Discontinuation'&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;77 DISCONFL='Did the Subject Discontinue the Study?'&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;78 DSRAEFL='Discontinued due to AE?'&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;79 VISNUMEN='End of Trt Visit (Vis 12 or Early Term.)'&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;80 ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;81 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;71:34 72:39&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Variable DSTERM is uninitialized.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 306 observations read from the data set SDTM.DS.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;WHERE STRIP(UPCASE(DSCAT))='DISPOSITION EVENT';&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.DS has 306 observations and 7 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.27 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.23 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Thu, 15 Jun 2017 22:08:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-assign-the-values-of-the-existing-variable-to-a-new/m-p/367529#M87514</guid>
      <dc:creator>SAS_John</dc:creator>
      <dc:date>2017-06-15T22:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign the values of the existing variable to a new variable with modification?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-assign-the-values-of-the-existing-variable-to-a-new/m-p/367536#M87519</link>
      <description>&lt;P&gt;Fix these two issues and you'll solve your problem:&lt;/P&gt;
&lt;DIV class="sasNote"&gt;NOTE: Numeric values have been converted to character values at the places given by: (Line)&lt;IMG class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" border="0" alt="Smiley Sad" title="Smiley Sad" /&gt;Column).&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;71:34 72:39&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;NOTE: Variable DSTERM is uninitialized.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&lt;FONT color="#000000"&gt;VISITNUM is likely character so you should have the values in quotes in the IF.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&lt;FONT color="#000000"&gt;DSTERM is not a variable in your dataset so your condition is never met, so all values are missing.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&lt;FONT color="#000000"&gt;Read your log.&amp;nbsp;&lt;/FONT&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 15 Jun 2017 22:39:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-assign-the-values-of-the-existing-variable-to-a-new/m-p/367536#M87519</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-06-15T22:39:00Z</dc:date>
    </item>
  </channel>
</rss>

