v*******g 发帖数: 334 | 1 start end weight1 weight2 weight3 weight4 weight_start weight_end
1 2 1.21 1.22 1.23 2.31 1.21 1.22
2 3 1.22 1.24 1.25 2.35 1.24 1.25
1 3 1.24 1.28 1.28 2.38 1.24 1.28
2 4 1.26 1.21 1.25 2.39 1.21 2.39
这是数据
start end weight1-4 是已有的变量, 现根据这6个变量给 weight_start 和
weight_end
赋值。我想的是下面的方法,可是太罗嗦了。怎么用 macro variabe 简化呢?
SAS code |
|
B**M 发帖数: 1521 | 2 Technical Specifications
Size and weight1
Height:
9.56 inches (242.8 mm)
Width:
7.47 inches (189.7 mm)
Depth:
0.5 inch (13.4 mm)
Weight:
1.5 pounds (.68 kg) Wi-Fi model;
1.6 pounds (.73 kg) Wi-Fi + 3G model
Display
* 9.7-inch (diagonal) LED-backlit glossy widescreen Multi-Touch display
with IPS technology
* 1024-by-768-pixel resolution at 132 pixels per inch (ppi)
* Fingerprint-resistant oleophobic coating
* Support for display of multiple languages and charac |
|
m*****s 发帖数: 156 | 3 this is paired sample design, used to minimize variation from difference
mice.
One analysis method could be to calculate the difference (d=weight1-weight2)
first. Then you could do a non-parametric sign test on d1, d2, ..., dn (n
is sample size or number of mice). Whether there is difference from the
material is equivalent to test whether d is greater than 0.
g |
|
A*******s 发帖数: 3942 | 4 这个用不着macro variable,直接用数组下标就行
data aaa;
array weight{4};
input start end weight1-weight4;
weight_start=weight(start);
weight_end=weight(end);
cards;
1 2 1.21 1.22 1.23 2.31
2 3 1.22 1.24 1.25 2.35
1 3 1.24 1.28 1.28 2.38
2 4 1.26 1.21 1.25 2.39
;
run;
end |
|
A*******s 发帖数: 3942 | 5 which variable has missing values? weight1-weight4 should be OK with missing
values but start and end are not.
it |
|
v******i 发帖数: 1246 | 6 proc transpose ....
so that you get
type age1 weight1 age2 weight2 |
|
n**********0 发帖数: 66 | 7 想到以下两个方法,但是肯定还有更好的:
方法一:用proc sql把这些weight从小到大变成weight1, weight2,weight 3...
然后再用loop一个个比,eg:
%do index = 1 %to I;
%let j=I+1;
%If &&weight&j- &&weight&i<5 %then %let weight&i=NA;
%end;
然后再变回去删掉等于NA的就好。
方法二:或者可以proc transpose把数值的都换到同一行可以直接用do loop |
|
|