Date: Wed, 23 Aug 2006 13:38:35 -0400
Reply-To: Venky Chakravarthy <swovcc@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Venky Chakravarthy <swovcc@HOTMAIL.COM>
Subject: Re: SAS won't listen to me!
As it has been shown by data _null_, your problem is can be replicated only
under certain special circumstances. One other way that this could happen
is with a length of $1 for parameter and then a leading space with the
assignment " 1011" ;
data a ;
sample = 298 ;
parameter = " " ;
run ;
data b ;
set a ;
if sample = 298 then parameter = " 1101" ;
run ;
options nocenter ;
proc print ;
run ;
Obs sample parameter
1 298
Venky Chakravarthy
On Wed, 23 Aug 2006 12:14:24 -0500, data _null_; <datanull@GMAIL.COM> wrote:
>Perhaps 298 is not exactly 298.
>
>data work.not298;
> do sample = (298+1e-6),298;
> x = sample;
> if sample eq 298 then parameter="1101";
> if round(sample,1) eq 298 then parameter2="1101";
> output;
> end;
> format x hex16.;
> run;
>proc print;
> run;
>
>Obs sample x parameter parameter2
>
> 1 298.000 4072A000010C6F7A 1101
> 2 298.000 4072A00000000000 1101 1101
>
>
>On 8/23/06, plessthanpoinohfive <plessthanpointohfive@gmail.com> wrote:
>> Oops, no, that's just an error in my post.
>>
>> I should have used
>>
>> data new; set old;
>> if sample = 298 then parameter="1101";
>> run;
>>
>> Then I wouldn't have flipped. The new dataset should have
parameter="1101"
>> and the old dataset should parameter=" ";
>>
>> Sorry....that was sloppy.
>>
>> Jen
>>
>>
>> -----Original Message-----
>> From: Xu Libin [mailto:Libin.Xu@irs.gov]
>> Sent: Wednesday, August 23, 2006 12:47 PM
>> To: plessthanpoinohfive; SAS-L@LISTSERV.UGA.EDU
>> Subject: RE: SAS won't listen to me!
>>
>> According to your description, you may need to change the dataset name.
>> Your source data is a and your destination data is b. See below:
>>
>>
>> data b; set a;
>> if sample = 298 then parameter="1101";
>> run;
>>
>>
>> Libin
>> -----Original Message-----
>> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
>> plessthanpoinohfive
>> Sent: Wednesday, August 23, 2006 12:39 PM
>> To: SAS-L@LISTSERV.UGA.EDU
>> Subject: SAS won't listen to me!
>>
>> So, I'm sure I'm doing something wrong. That's always the case.
>>
>> Here's what I am trying to do. It's very simple. I want to go into a
>> data
>> step and tell SAS to change the value of an individual's parameter.
>>
>> data a; set b;
>> if sample = 298 then parameter="1101";
>> run;
>>
>> Parameter is a text variable, sample is numeric. The value of parameter
>> for
>> sample 298 was blank in data a. In data b I want it to be set to 1101.
>>
>> However, when I run the above code the value of parameter in data b for
>> sample 298 remains blank.
>>
>> Why does this happen? I'm sure it's simple.
>>
>> Thanks,
>>
>> Jen
>>
|