由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - Help! A data step problem
相关主题
SAS CODE HELP!SAS help : The scope of macro variables
一个关于macro的问题,多谢。请教一个SAS recode variable的问题吧
SAS 问题:关于比较variable 包子答谢问一个sas问题
[合集] 问个SAS的问题question about using sas macro variable and do loop
[合集] 请教一个sas问题问一个SAS DATA 处理的问题,谢谢!
菜鸟请教关于赋给macro variables变量值Clustering analysis with categorical variables
how to use first.var in sas macro?请问 SAS转到 R 的问题
一个sas macro variable的问题。复杂分类变量recoding?
相关话题的讨论汇总
话题: values话题: low话题: high话题: labels
进入Statistics版参与讨论
1 (共1页)
f*****k
发帖数: 110
1
I have a variable X whose values and value labels like these:
X's values value labels
------------------------------
unknown concentration
low low concentration
mid middle concentration
high high concentration
I want to use a macro to automatically recode a new variable Y like this:
Y's values value labels
------------------------------
X_ unknown concentration (X to Y)
X_low low concentration (X to Y)
X_mid middle concentration (X to Y)
X_high high concentration (X to Y)
How should I do so? Thanks a lot!
a*****3
发帖数: 601
2
好奇手写不行么? 非要macro?
l*********s
发帖数: 5409
3
not good for showing off :-)

【在 a*****3 的大作中提到】
: 好奇手写不行么? 非要macro?
f*****k
发帖数: 110
4
Definitely not showoff. I need to do hundreds of variables like this, so I
have to use macro.

【在 l*********s 的大作中提到】
: not good for showing off :-)
a*****3
发帖数: 601
5
还是不明白这种low,mid,high怎么会有上百种情况, anyway 也许可以这么做:
1.你把这几百种情况写出来,
2.倒进dataset里面,用begin,label,hlo,etc做header
3.用proc format读进来,用cntlin= 选项
不过又做1的功夫, 直接在proc format手写也写出来了.

【在 f*****k 的大作中提到】
: Definitely not showoff. I need to do hundreds of variables like this, so I
: have to use macro.

l*********s
发帖数: 5409
6
You don't need to do 1 manually. You can output format with proc format into
a dataset and modify it with data step.

【在 a*****3 的大作中提到】
: 还是不明白这种low,mid,high怎么会有上百种情况, anyway 也许可以这么做:
: 1.你把这几百种情况写出来,
: 2.倒进dataset里面,用begin,label,hlo,etc做header
: 3.用proc format读进来,用cntlin= 选项
: 不过又做1的功夫, 直接在proc format手写也写出来了.

f*****k
发帖数: 110
7
I need to do such X -- Y transformation for hundreds of other variables Z1 .
.. Z500, whose values are not always "low, mid or high". Eg., Z1 may have
values as "empty" and "red". More importantly, in another dataset, the
variables and values may change. So, ideally, I hope to have a macro that
can automatically do such transformation for any given variable in any given
dataset.

【在 a*****3 的大作中提到】
: 还是不明白这种low,mid,high怎么会有上百种情况, anyway 也许可以这么做:
: 1.你把这几百种情况写出来,
: 2.倒进dataset里面,用begin,label,hlo,etc做header
: 3.用proc format读进来,用cntlin= 选项
: 不过又做1的功夫, 直接在proc format手写也写出来了.

1 (共1页)
进入Statistics版参与讨论
相关主题
复杂分类变量recoding?[合集] 请教一个sas问题
SAS Macro 问题请教 。。。菜鸟请教关于赋给macro variables变量值
请教一个很白痴的回归分析的问题how to use first.var in sas macro?
[help]10个包子求KDD cup 2009 的orange公司dataset一个sas macro variable的问题。
SAS CODE HELP!SAS help : The scope of macro variables
一个关于macro的问题,多谢。请教一个SAS recode variable的问题吧
SAS 问题:关于比较variable 包子答谢问一个sas问题
[合集] 问个SAS的问题question about using sas macro variable and do loop
相关话题的讨论汇总
话题: values话题: low话题: high话题: labels