Date: Thu, 28 Sep 2006 15:18:14 -0400
Reply-To: "data _null_;" <datanull@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "data _null_;" <datanull@GMAIL.COM>
Subject: Re: A DATA MANUPULATION QUESTION
In-Reply-To: <200609281856.k8SAoSvu005195@mailgw.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Let the functions and formats help you. This is a V8 way. With v9
you can use vvalue.
data work.test;
input FREQ PERCENT @@;
format freq 2. percent negparen7.1;
length display $10;
if percent
then display =
putn(freq,vformat(freq))||putn(-percent,(vformat(percent)));
else display = putn(freq,vformat(freq));
cards;
0 0 3 10.8 2 5.76 5 8.98 6 5.77 7 8.77
;;;;
run;
proc print;
run;
On 9/28/06, Rathindronath <mehedisas@yahoo.com> wrote:
> I have a dataset with following two numeric variables:
>
> FREQ PERCENT
> ____ _______
> 3 10.8
> 2 5.76
> 5 8.98
> 6 5.77
> 7 8.77
>
> How can I turn them to one variable as follows (charcter variable):
>
> FREQ
> ________
> 3 (10.8)
> 2 (5.76)
> 5 (8.98)
> 6 (5.77)
> 7 (8.77)
>
>
> Thanks in Advance
>
|