[prev in list] [next in list] [prev in thread] [next in thread]
List: sas-l
Subject: transpose and variable conversion
From: pausha1 () GMAIL ! COM
Date: 2008-04-30 12:01:49
Message-ID: b9581b0d-9287-4fab-a886-10410136941b () 2g2000hsn ! googlegroups ! com
[Download RAW message or body]
my transpose is not working Iam not sure of my id var as well i get
an error in conversion the variable ga and impga got to be numeric for
comparison.
%macro ser(dad=);
%exist(dad = &dad)
Proc format;
value $ps
'mon - 0'=0
‘tue - 1'=1
'wed - 2'=2
'thu - 3'=3
'fri - 4'=4
'Sat - 5'=5;
run;
data event(keep = tam sub site num vis ga);
set clean;
ga =put(ga, $ps.);
run;
proc sort data=event out=event (keep = tam sub site num vis ga);
by sub site vis;
where num >= 8 ;
run;
proc transpose data=event out=envir (drop = _name_ _label_);
by sub site;
id vis;
var ga;
run;
data envir (keep = sub week_12 week_16 week_20 week_24 elig);
format elig $5.;
set envir;
by sub;
array current {*} week_12 week_16 week_20 week_24;
array prior {*} prwk_12 prwk_16 prwk_20 prwk_24 ;
array post {*} pswk_12 pswk_16 pswk_20 pswk_24 ;
array prdist {*} pr_12 pr_16 pr_20 pr_24 ;
array psdist {*} ps_12 ps_16 ps_20 ps_24 ;
elig = 'No';
do i=2 to dim(current);
if current{i} ne . then elig = 'Yes';
end;
if elig = 'Yes' then do;
do i=2 to dim(current) - 1;
if current{i}=. then do;
do j = 1 to dim(current);
if j < i and current {j} ne . then do;
prior{i} = current{j};
prdist{i} = j;
end;
if j > i and post{i} = . and current {j} ne . then do;
post{i} = current{j};
psdist{i} = j;
end;
end;
end;
if current{i} = . then current{i} = prior{i} - (prior{i} -
post{i}) * (prdist{i} - i)/(prdist{i} - psdist{i});
end;
end;
run;
proc sort data = envir;
by elig sub ;
run;
proc transpose data= envir out=envir;
by elig sub ;
run;
NOTE: No
variables to transpose.
data envir (keep = elig sub vis col1 rename = (col1=impga));
format vis $30.;
set envir;
vis = 'Week ' || substr(_name_,index(_name_,'_')+1,2);
run;
proc sort data = envir;
by sub vis;
run;
data event;
merge event (in=a)
envir (in=b);
by sub vis;
if a;
weeks = max(0,input(substr(vis,6,2),3.) - 12);
if ga = . and impga ne . then ga = impga;
run;
proc sort data = event out=event (keep = sub tam num vis weeks ga );
by sub num;
where elig = 'Yes' and ga ne .;
I get
an error
ERROR: Where clause operator requires
compatible variables.
run;
%endit:
%mend;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic