LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2006, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 29 Sep 2006 10:09:14 -0300
Reply-To:   "marcio_m_r@hotmail.com" <marcioestat@POP.COM.BR>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "marcio_m_r@hotmail.com" <marcioestat@POP.COM.BR>
Subject:   Re: Mofify data values of n's variables
In-Reply-To:   <BAY123-F20241041CF38A06D361814DE1B0@phx.gbl>
Content-Type:   text/html;charset=iso-8859-1

<pre>Hey Toby and listers,</pre><pre>I found out how to modify a group of variables values,</pre><pre>using ARRAY with the code below. But I am now searching if&nbsp;is there a was to&nbsp;set a&nbsp;format for the label,</pre><pre>because I&nbsp;want to get 1 into YES, 2&nbsp;into NO and 3 into BLANK for all variables of my dataset. Do you have any&nbsp;idea?</pre><pre>Remenber that I have almost 100 variables and if I use PROC FORMAT, the code will be not functional.</pre><pre>Thanks,</pre><pre>M&aacute;rcio&nbsp;</pre><pre>data lib.fix(drop=i);</pre><pre>set lib.fix;</pre><pre>array fix(1:10) PA10101 PA10102 PA10103 PA10104 PA10201 PA10202 PA10203 PA10204 PA10205 PA10301;</pre><pre>do i=1 to 10;</pre><pre>if fix(i)='s' then fix(i)='1';</pre><pre>end;</pre><pre>do i=1 to 10;</pre><pre>if fix(i)='n' then fix(i)='2';</pre><pre>end;</pre><pre>do i=1 to 10;</pre><pre>if fix(i)=' ' then fix(i)='3';</pre><pre>end;</pre><pre>run;</pre><p><br />--------------------------------------------------------------------------------<br />Depends on how they are named, if there is some commonality to them you can <br />always hit the dictionary.columns table and grab them, otherwise no matter <br />what any one comes up with you are stuck writing them out by hand.<br /><br /><br /><br />Toby Dunn<br /><br />When everything is coming at you all at once, your in the wrong lane.<br /><br />A truly happy person is someone who can smile and enjoy the scenery on a <br />detour.<br /><br /><br /><br /><br /><br />From: &quot;marcio_m_r@hotmail.com&quot; To: &quot;toby dunn&quot; Subject: Re: Mofify data values of n's variables<br />Date: Thu, 28 Sep 2006 15:23:12 -0300 (EST)<br /><br /><br />Hey Toby,<br />I got what you did, but the problem is that I have about 100<br />variables. So, I would need to do the proc format for 100 variables. Do you <br />know if<br />is there a way to apply the same proc format to a group of<br />variables?<br />Thanks,<br />M&aacute;rcio<br /><br />--------------------------------------------------------------------------------<br />Marcio ,<br /><br />Call me crazy but why dont you skip to just formtting the<br />YES/NO/MISSING to<br />YES/NO/NO RESPONSE?<br /><br /><br />Proc Format ;<br />Value $NewRecode<br />'MISSING' = 'NO RESPONSE' ;<br />Run ;<br /><br />Should do<br />it.<br /><br /><br />Toby Dunn<br /><br />When everything is coming at you all at<br />once, your in the wrong lane.<br /><br />A truly happy person is someone who can<br />smile and enjoy the scenery on a<br />detour.<br /><br /><br /><br /><br /><br />From: &quot;marcio_m_r@hotmail.com&quot; Reply-To:<br />&quot;marcio_m_r@hotmail.com&quot; To: SAS-L@LISTSERV.UGA.EDU<br />Subject: Mofify<br />data values of n's variables<br />Date: Thu, 28 Sep 2006 10:59:59 -0300<br /><br /><br />Hey all,<br />I have a dataset with a big number of variables that I have<br />the<br />same results YES/NO/MISSING and I am planning to modify the data<br />value and put a format on them to get what I want. I could do this utilizing<br />IF<br />THEN, but they're a lot of variables.<br />As I said my variables are<br />character<br />and I want to replace YES into 1, NO into 2 and MISSING into 3, then<br />I could<br />use<br />some kind of format on these variables as 1 into YES, 2 into<br />NO and 3 into<br />NO<br />RESPONSE. I made some research on PROC SQL ALTER<br />TABLE/UPDATE, but I did not<br />make<br />it. Any suggestions?<br />Thanks in<br />advance,<br />M&aacute;rcio<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></p>


Back to: Top of message | Previous page | Main SAS-L page