Date: Wed, 13 Oct 1999 09:24:50 -0500
Reply-To: Kevin Brunson <kbrunson@ND.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Kevin Brunson <kbrunson@ND.EDU>
Organization: College of Business, Notre Dame
Subject: reading date values Solaris v. NT
Content-Type: text/plain; charset=us-ascii
A user reported a problem reading date values running the same program with
the same data on 2 different computers with v. 6.12, TS060. He claims that
the data is read correctly on a machine running NT but is incorrect on Win98.
To test I ran the program on Solaris and NT; SAS is v. 6.12 on both, TS045 on
Solaris and TS060 on NT. Below I listed the input file, a few lines from the
listings and logs from both OS's, and the SAS program. Solaris reads the date
values as desired but NT fails when the month is a single digit.
Should the SAS format behave differently on the two systems? Is there a format
that will read the dates correctly on NT--I can't find one. The user wants to
do calculations with dates so he needs a SAS date value.
------------------------------------------------------
A snippet of the CSV input file:
12/31/81,2584,.,1232,.,75.53,.,.,.,.,.,.
1/31/82,2602,2584,1237,1232,72.73,75.53,.,.,13.45,2.5,16.36
2/28/82,2581,2602,1245,1237,73.94,72.73,.,.,15.78,3.58,24.65
3/31/82,2593,2581,1241,1245,69.47,73.94,.,.,14.68,1.95,11.89
4/30/82,2590,2593,1241,1241,71.22,69.47,.,.,15.98,2.23,26.69
5/31/82,2577,2590,1242,1241,67.88,71.22,.,.,20.68,2.95,27.19
6/30/82,2594,2577,1237,1242,72.17,67.88,.,.,16.13,1.81,22.51
7/31/82,2645,2594,1241,1237,67.08,72.17,.,.,14.99,1.5,18.05
8/31/82,2731,2645,1261,1241,72.79,67.08,.,.,10.11,0,16.74
9/30/82,2848,2731,1297,1261,74.53,72.79,.,.,7.3,-0.68,11.23
10/31/82,2985,2848,1349,1297,69.71,74.53,.,.,5.67,-0.28,8.75
11/30/82,3084,2985,1411,1349,65.97,69.71,.,.,5.55,1.6,9.05
12/31/82,3120,3084,1465,1411,68.29,65.97,.,.,5.93,3.35,8.6
Proc Print from Solaris:
OBS DATE YR MO DY
1 8035 1981 12 31
2 8066 1982 1 31
3 8094 1982 2 28
4 8125 1982 3 31
5 8155 1982 4 30
6 8186 1982 5 31
7 8216 1982 6 30
8 8247 1982 7 31
9 8278 1982 8 31
10 8308 1982 9 30
11 8339 1982 10 31
12 8369 1982 11 30
13 8400 1982 12 31
14 8431 1983 1 31
15 8459 1983 2 28
Proc Print from NT:
OBS DATE YR MO DY
1 8035 1981 12 31
2 . . . .
3 . . . .
4 . . . .
5 . . . .
6 . . . .
7 . . . .
8 . . . .
9 . . . .
10 . . . .
11 8339 1982 10 31
12 8369 1982 11 30
13 8400 1982 12 31
14 . . . .
15 . . . .
From the Solaris log:
NOTE: Invalid data for MEDRATE in line 4 55-60.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+
4 CHAR 1/31/82,2602,2584,1237,1232,72.73,75.53,.,.,13.45,2.5,16.36. 60
ZONE 323323323333233332333323333233233233233222223323323232332330
NUMR 1F31F82C2602C2584C1237C1232C72E73C75E53CECEC13E45C2E5C16E36D
DATE=8066 IPCEND=2602 IPCBEG=2584 UFEND=1237 UFBEG=1232 IGPAEND=72.73
IGPABEG=75.53 IPSAEND=. IPSABEG=. STRAT=13.45 RFRATE=2.5 MEDRATE=. YR=1982
MO=1 DY=31 _ERROR_=1 _N_=2
From the NT log:
NOTE: Invalid data for DATE in line 4 1-8.
4 1/31/82,2602,2584,1237,1232,72.73,75.53,.,.,13.45,2.5,16.36 59
DATE=. IPCEND=2602 IPCBEG=2584 UFEND=1237 UFBEG=1232 IGPAEND=72.73
IGPABEG=75.53 IPSAEND=. IPSABEG=. STRAT=13.45 RFRATE=2.5 MEDRATE=16.36 YR=.
MO=. DY=. _ERROR_=1 _N_=2
SAS program (Solaris version):
data dindex;
infile "indxrat2.csv" dlm=',' missover;
input date mmddyy8. ipcend ipcbeg ufend ufbeg igpaend igpabeg ipsaend
ipsabeg strat rfrate medrate;
yr = year(date);
mo = month(date);
dy = day(date);
proc print data = dindex;
var date yr mo dy;
|