由买买提看人间百态

topics

全部话题 - 话题: mmddyy8
(共0页)
c*****7
发帖数: 54
1
来自主题: Statistics版 - 一个很疑惑的SAS日期问题
对于图1中的问题,我编的code如下(可以运行):
DATA RESPOND;
INPUT CALL_NO 1-3 @5 DATE MMDDYY8. TRUCKS 14-15 ALARM 17;
FORMAT DATE MMDDYY8.;
DATALINES;
001 10/21/94 03 2
002 10/23/94 01 1
003 11/01/94 11 3
;
PROC PRINT DATA=RESPOND;
RUN;
但是如果我按照如下两种code就运行不成功,但是一直不知道原因何在啊?
第一种:
DATA RESPOND;
INFORMAT DATE MMDDYY8.;
INPUT CALL_NO 1-3 DATE 5-12 TRUCKS 14-15 ALARM 17;
DATALINES;
001 10/21/94 03 2
002 10/23/94 01 1
003 11/01/94 11 3
;
PROC PRINT DATA=RESPOND;
RUN;
第二种:
DATA RESPOND;
INFORMAT DATE MMDDYY8.;
p********a
发帖数: 5352
2
来自主题: Statistics版 - 一个sas问题,谢谢
try this one:
DATA RESPOND;
FORMAT DATE mmddyy8. ;
INPUT @1 CALL_NO $3. @5 DATE mmddyy8. @14 TRUCKS $2. @17 ALARM 5.;
DATALINES;
001 10/21/94 03 2
002 10/23/94 01 1
003 11/01/94 11 3
RUN;
s******r
发帖数: 1524
3
来自主题: Statistics版 - 问个sas问题(包子)
You can do with sql in one step, why use sort.
PROC SQL;
CREATE TABLE FINAL AS
SELECT A.ID,
A.EVENT_DATE format=mmddyy8.,
max(B.ADMISSION_DATE) format=mmddyy8. as max_admiss
FROM FILE1 AS A LEFT JOIN FILE2 AS B
ON A.ID = B.ID AND A.EVENT_DATE >= B.ADMISSION_DATE
group by a.id,a.event_date
ORDER BY ID, EVENT_DATE;
QUIT;
o*******w
发帖数: 2310
4
来自主题: Statistics版 - WHICH ONE IS CORRECT?
A raw data file is listed below.
----|----10---|----20---|----30
son Frank 01/31/89
daughter June 12-25-87
brother Samuel 01/17/51
The following program is submitted using this file as input.
data work.family;
infile file-specification;

run;
Which INPUT statement correctly reads the values for the variable BIRTHDATE
as SAS date values?
A. input relation $ first_name $ birthdate date9.;
B. input relation $ first_name $ birthdate mmddyy8.;
C. input relation $ first_na... 阅读全帖
s******r
发帖数: 1524
5
来自主题: Statistics版 - 菜鸟问个SAS问题
It works.
data b;
do i =1 to 100;
time=intnx('day','01Jan2013'd,i);output;
end;
run;
data a;
set b end=last;
retain mintime maxtime;
if _n_=1 then mintime=time;
if last then maxtime=time;
run;
or you can do,
proc sql;
create table b as
select max(time) format=mmddyy8. max_time,
min(time) format=mmddyy8. min_time
from b;
quit;run;
i********6
发帖数: 2
6
来自主题: Statistics版 - 一个sas问题,谢谢
DATA RESPOND;
INFORMAT DATE MMDDYY8.;
INPUT CALL_NO 1-3 DATE 5-12 TRUCKS 14-15 ALARM 17;
DATALINES;
001 10/21/94 03 2
002 10/23/94 01 1
003 11/01/94 11 3
;
RUN;
提示说日期的数据不对. 请问是哪里不对了, 谢谢.
'Invalid data for DATE in line 312 5-12.'
t*****n
发帖数: 167
7
来自主题: Statistics版 - SAS 问题请教
1.A raw data file is listed below.
1---+----10---+----20---+---
son Frank 01/31/89
daughter June 12-25-87
brother Samuel 01/17/51
The following program is submitted using this file as input:
data work.family;
infile 'file-specification';

run;
Which INPUT statement correctly reads the values for the variable Birthdate
as SAS
date values?
a. input relation $ first_name $ birthdate date9.;
b. input relation $ first_name $ birthdate mmddyy8.;
c. input relation $ first_n
c*****7
发帖数: 54
8
来自主题: Statistics版 - SAS里关于recode一问
我还是有两个疑问噢,
你说不可以省略如下这一段:
PROC FREQ DATA = GRADES;
TITLE 'Example 3';
TABLE SCORE;
FORMAT SCORE SCOREFMT.;
RUN;
第一个问题:我没看出来改前和改后的这两段有什么本质区别啊,没看出来第一个是对于
整数啊,
改前:
PROC FORMAT
VALUE SCOREFMT 0-64 = 'Fail'
65-69 = 'Low Pass'
70-79 = 'Pass'
80-89 = 'High Pass'
90-HIGH = 'Honors';
RUN;
改后:
PROC FORMAT
VALUE SCOREFMT 0-<65 = 'Fail';
65-<70 = 'Low Pass'
70-<80 = 'Pass'
80-<90 = 'High Pass'
90-HIGH = 'Honors';
RUN;
第二个问题:
FORMAT SCORE SCOREFMT.
你说FORMAT后面都要加点,比如FORMAT DOB MMDDYY8.;这里8后面之所以加点是因为规定
字符的长度吧?可
o****o
发帖数: 8077
9
来自主题: Statistics版 - 一个很疑惑的SAS日期问题
you can't use informat and position at the same time. The position code will
serve as $ informat of specific length. try to delete the 5-10 after DATE:
DATA RESPOND;
INFORMAT DATE MMDDYY8.;
INPUT CALL_NO 1-3 DATE TRUCKS 14-15 ALARM 17;
DATALINES;
001 10/21/94 03 2
002 10/23/94 01 1
003 11/01/94 11 3
;
run;
and for the second non-executable code, you forget a ";" after FORMAT statement
j**********e
发帖数: 442
10
来自主题: Statistics版 - 急问
小弟新手上路,有个问题,如何读入日期数据比如6/8/2005
我写的input VA mmddyy8.
或是input VA date8.
可是SAS都读不出来?怎么办啊?
多谢各位大哥大姐指点!!
s*******s
发帖数: 2
11
来自主题: Statistics版 - 急问
这个应该用MMDDYY10.而不是MMDDYY8.
b*******g
发帖数: 513
12
Maybe, you can try the following codes:
options nodate;
Data Dates;
adate="05/23/07";
WkDate = input(adate,mmddyy8.);
Fdate1 = put(Wkdate,mmyy5.);
run;
proc print data=dates;
run;
b*******g
发帖数: 513
13
Or maybe, the following codes:
options nodate;
data one;
input adate mmddyy8.;
cards;
05/31/07
01/01/01
02/03/05
;
data two;
set one;
format adate mmyy5.;
run;
proc print data=two;
run;
p*****d
发帖数: 44
14
来自主题: Statistics版 - 已解决
是mmddyy8.吗?
f*****k
发帖数: 110
15
来自主题: Statistics版 - 问个sas问题(包子)
I guess the effect of the CASE statement is equivalent to huaifans' code --
max(B.ADMISSION_DATE) format=mmddyy8. as max_admiss. But I am not sure why
using CASE statement here. In addition, why use LEFT JOIN? I tried JOIN only
and it worked.
a****r
发帖数: 71
16
请教一个《Carpenter's Complete Guide to the SAS Macro》上SAS macro的例子。
Chapter 6, Page 111 有一个根据data A1 里两个变量 station 和 depth 生成 一系
列ACSII文件的macro的例子;
**********************;
***6.2.1d
***%DOIT
**********************;
* 1993 Water quality data.
*************************************************;
data a1
(keep=datetime station depth temp ph do cond salinity);
input datetime datetime13. @15 station $3.
depth temp ph do cond salinity;
label datetime = 'date and time of sample collection'
st... 阅读全帖
s********1
发帖数: 54
17
______________________________________________
I got the following error message:
______________________________________________
ERROR: Insufficient authorization to access C:\Program Files\SASHome\
SASFoundation\9.3\TS30.dat
______________________________________________
My code is as follows:
______________________________________________
**********************;
***6.2.1d
***%DOIT
**********************;
* 1993 Water quality data.
*************************************************;
data a1
... 阅读全帖
(共0页)