由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - 慕名而来,请教一个 SAS date question
相关主题
Help: covert SAS char date into numeric dateSAS format 的问题
请问怎样用SAS根据变量标题创建新的变量?SAS问题请教
sas question请教工作中遇到的correlation问题
一道SAS面试题,关于dummy variable请教SAS base 70题中的68题
SAS包子请教SAS问题请教:Numeric Variable Length的设定
help how to convert char to numeric variable?SAS Base 50题中的30和33题疑问
Import excel file to sas (the first 8 or more observations[SAS]一个比较大的dataset中求特定对variable的R2
SAS data merge求助如何计算normal distribution function的cdf numerically?
相关话题的讨论汇总
话题: sas话题: yyyymmdd话题: mdy话题: 慕名而来话题: many
进入Statistics版参与讨论
1 (共1页)
l******o
发帖数: 162
1
three variables (all numeric)
year month day
need to convert to yyyymmdd SAS format so that I can calculate the days
between this yyyymmdd with another yyyymmdd.
can anybody help me with this?
Many thanks.
g*******y
发帖数: 380
2
you can use mdy function.
try search online, for instance: google: "sas, mdy (function)".
For an example: the following code is online:
DATA dates;
INPUT month 1-2 year 4-7 day 9-10;
bday=MDY(month,day,year);
CARDS;
7 1948 11
1 1960 1
10 1970 15
12 1971 10
;
RUN;
btw: SAS date is numeric, if you just need diffenrence between two dates?
you don't have to format it as yyyymmdd or else.
d********h
发帖数: 2048
3
why convert?
difference=(year1-year2)*365+(month1-month2)*12+(day1-day2);
l******o
发帖数: 162
4
many thanks. mdy works well.
l******o
发帖数: 162
5
year, month, day are THREE variables while another is only yyyymmdd. so I
have to convert.
bdy works well.

【在 d********h 的大作中提到】
: why convert?
: difference=(year1-year2)*365+(month1-month2)*12+(day1-day2);

l******o
发帖数: 162
6
I only have 1.70 cash in my a/c and just couldn't give you any money. Sorry.

【在 g*******y 的大作中提到】
: you can use mdy function.
: try search online, for instance: google: "sas, mdy (function)".
: For an example: the following code is online:
: DATA dates;
: INPUT month 1-2 year 4-7 day 9-10;
: bday=MDY(month,day,year);
: CARDS;
: 7 1948 11
: 1 1960 1
: 10 1970 15

g*******y
发帖数: 380
7
客气,这个也要包子的话,我在版上得到的帮助足够我破产了.

Sorry.

【在 l******o 的大作中提到】
: I only have 1.70 cash in my a/c and just couldn't give you any money. Sorry.
1 (共1页)
进入Statistics版参与讨论
相关主题
如何计算normal distribution function的cdf numerically?SAS包子请教
SAS里面怎么设置vectorhelp how to convert char to numeric variable?
一道SAS BASE题,HELP!Import excel file to sas (the first 8 or more observations
SAS quarter calculation questionSAS data merge求助
Help: covert SAS char date into numeric dateSAS format 的问题
请问怎样用SAS根据变量标题创建新的变量?SAS问题请教
sas question请教工作中遇到的correlation问题
一道SAS面试题,关于dummy variable请教SAS base 70题中的68题
相关话题的讨论汇总
话题: sas话题: yyyymmdd话题: mdy话题: 慕名而来话题: many