The SAS Output Delivery System and reporting techniques

use variable with variable value

Reply
N/A
Posts: 0

use variable with variable value

Hi,

I've got a dataset with variables var1 to var4.
And I want do normalize them.

I've tried this code:


data test;
set tst;

do i=1 to 4;
output_var1 = var+i;
output;
end;
run;


But it doesn't work...
Can anyone help me?
Super Contributor
Posts: 260

Re: use variable with variable value

Posted in reply to deleted_user
What do you exactly mean by "normalizing" ? Can we have a sample with data of what you have as an input, and what you want to create ?
N/A
Posts: 0

Re: use variable with variable value

Source:
var1 var2 var3
one 1 11
two 2 12
three 3 13

The output should be:
var1 var
one 1
one 11
two 2
two 12
three 3
three 13
Super Contributor
Posts: 260

Re: use variable with variable value

Posted in reply to deleted_user
DATA newlyCreated ;
SET existing ;
ARRAY values
var2 var3 /* here you can list all the variables that contain values */ ;
DO OVER values ;
var = values ;
OUTPUT ;
END ;
RUN ;
N/A
Posts: 0

Re: use variable with variable value

Oliver,

Thanks a lot!
That's exactly what I'm looking for!!
Ask a Question
Discussion stats
  • 4 replies
  • 154 views
  • 0 likes
  • 2 in conversation