Date: Mon, 17 Mar 2008 20:32:52 -0400
Reply-To: Arthur Tabachneck <art297@NETSCAPE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Arthur Tabachneck <art297@NETSCAPE.NET>
Subject: Re: If I can Rename Why can't change the Label in dataset Options
I thought of yet another way of doing what you say you want, but I do have
to ask why you would want to do this?
Regardless, if you really want to do it, something like the following
might suffice:
data suppqual;
input qnam $ qval;
cards;
ATC1C 1
ATC1T 2
ATC2C 3
ATC2T 4
ATC3C 5
ATC3T 6
ATC4C 7
ATC4T 8
GENNAME 9
WHOMEDC 0
;
data Atc_code_1 (keep = ATC1C )
Atc_text_1 (keep = ATC1T )
Atc_code_2 (keep = ATC2C )
Atc_text_2 (keep = ATC2T )
Atc_code_3 (keep = ATC3C )
Atc_text_3 (keep = ATC3T )
Atc_code_4 (keep = ATC4C )
Atc_text_4 (keep = ATC4T )
Generic_5 (keep = GENNAME)
WHOMEDC (keep = WHOMEDC) ;
set Suppqual;
If Qnam = "ATC1C" then do;
ATC1C=qval;
label ATC1C="ATC 1 Code";
Output Atc_code_1;
end;
else If Qnam = "ATC1T" then do;
ATC1T=qval;
label ATC1T="ATC 1 Text";
Output Atc_text_1 ;
end;
else If Qnam = "ATC2C" then do;
ATC2C=qval;
label ATC2C="ATC 2 Code";
Output Atc_code_2;
end;
else If Qnam = "ATC2T" then do;
ATC2T=qval;
label ATC2T="ATC 2 Text";
Output Atc_text_2 ;
end;
else If Qnam = "ATC3C" then do;
ATC3C=qval;
label ATC3C="ATC 3 Code";
Output Atc_code_3;
end;
else If Qnam = "ATC3T" then do;
ATC3T=qval;
label ATC3T="ATC 3 Text";
Output Atc_text_3 ;
end;
else If Qnam = "ATC4C" then do;
ATC4C=qval;
label ATC4C="ATC 4 Code";
Output Atc_code_4;
end;
else If Qnam = "ATC4T" then do;
ATC4T=qval;
label ATC4T="ATC 4 Text";
Output Atc_text_4 ;
end;
else If Qnam = "GENNAME" then do;
GENNAME=qval;
label GENNAME="GEN Name";
Output Generic_5;
end;
else If Qnam = "WHOMEDC" then do;
WHOMEDC=qval;
label WHOMEDC="WHOMEDC";
Output WHOMEDC ;
end;
Run;
Art
--------
On Mon, 17 Mar 2008 14:15:03 -0400, SAS_learner <proccontents@GMAIL.COM>
wrote:
>Hello _all_
>
>I am doing something like this (I know I can do it with Transpose but I
need
>to validate and Program is using is Transpose) .
>Rename part is working Fine but the Label for the variable should also be
>changed it is giving me error . If say something like
>
>Rename Label = Qlabel ( I want the Value of Qlabel to be Label of this
>Variable ) I am Label as Data value ?? Is this Possible to do in
>same dataset ??
>
>data Atc_code_1 (Rename = (Qval = ATC1C ) Label=( Qval = "ATC 1 Code") )
> Atc_text_1 (Rename = (Qval = ATC1T ))
> Atc_code_2 (Rename = (Qval = ATC2C ))
> Atc_text_2 (Rename = (Qval = ATC2T ))
> Atc_code_3 (Rename = (Qval = ATC3C ))
> Atc_text_3 (Rename = (Qval = ATC3T ))
> Atc_code_4 (Rename = (Qval = ATC4C ))
> Atc_text_4 (Rename = (Qval = ATC4T ))
> Generic_5 (Rename = (Qval = GENNAME))
> WHOMED (Rename = (Qval = WHOMEDC)) ;
>set Suppqual;
>If Qnam = "ATC1C" then Output Atc_code_1 ;
>If Qnam = "ATC1T" then Output Atc_text_1 ;
>
>If Qnam = "ATC2C" then Output Atc_code_2 ;
>If Qnam = "ATC2T" then Output Atc_text_2 ;
>
>If Qnam = "ATC3C" then Output Atc_code_3 ;
>If Qnam = "ATC3T" then Output Atc_text_3 ;
>
>If Qnam = "ATC4C" then Output Atc_code_4 ;
>If Qnam = "ATC4T" then Output Atc_text_4 ;
>
>If Qnam = "GENNAME" then Output Generic_5 ;
>If Qnam = "WHOMEDC" then Output WHOMED ;
>Run;