Hi,
I tried to construct lagged variables from t-1 to t-5 and had the following error message. The SAS version is 9.3 (TS1M2) and Window 7 with 64 bit OS is installed on my PC. Thanks for your help
27 data s3; set s2;
28 lag_txpd = lag(txpd);
29 if gvkey ne lag(gvkey) then lag_txpd = .;
30 lag2_txpd = lag2(txpd);
31 if gvkey ne lag2(gvkey) then lag2_txpd = .;
32 lag3_txpd = lag3(txpd);
33 if gvkey ne lag3(gvkey) then lag3_txpd = .;
34 lag4_txpd = lag4(txpd);
35 if gvkey ne lag4(gvkey) then lag4_txpd = .;
36 lag5_txpd = lag5(txpd);
37 if gvkey ne lag5(gvkey) then lag5_txpd = .; run;
ERROR: An exception has been encountered.
Please contact technical support and provide them with the following traceback information:
The SAS task name is [DATASTEP]
ERROR: Read Access Violation DATASTEP
Exception occurred at (04937817)
Task Traceback
Address Frame (DBGHELP API Version 4.0 rev 5)
0000000004937817 000000000A16A1F0 sasxkern:tkvercn1+0x667D7
000000000493BD28 000000000A16A320 sasxkern:tkvercn1+0x6ACE8
00000000049366B0 000000000A16A3C0 sasxkern:tkvercn1+0x65670
0000000004B1E4F0 000000000A16A3C8 sasyh:tkvercn1+0x2D4B0
0000000004B1D750 000000000A16B040 sasyh:tkvercn1+0x2C710
0000000004B1684B 000000000A16B210 sasyh:tkvercn1+0x2580B
0000000004AF2EBD 000000000A16B9A0 sasyh:tkvercn1+0x1E7D
000000000697D6B5 000000000A16B9A8 sasyoio:tkvercn1+0x1C675
00000000069751A1 000000000A16F8F0 sasyoio:tkvercn1+0x14161
0000000008459CBC 000000000A16F8F8 sasdsx:tkvercn1+0x8C7C
0000000008451215 000000000A16FC20 sasdsx:tkvercn1+0x1D5
00000000068F16A1 000000000A16FC28 sasds:tkvercn1+0x661
00000000068F1495 000000000A16FCB0 sasds:tkvercn1+0x455
0000000003478FD7 000000000A16FCB8 sashost:Main+0xF917
000000000347D5FD 000000000A16FF50 sashost:Main+0x13F3D
0000000077445A4D 000000000A16FF58 kernel32:BaseThreadInitThunk+0xD
000000007767B831 000000000A16FF88 ntdll:RtlUserThreadStart+0x21
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 0.13 seconds
cpu time 0.07 seconds
Have tried using a subset of S2 such as just 5 or 10 records? Does it generate the same error?
What does a Proc Contents show for S2?
Yes. The error message comes out again.
77 data s3; set s2;
78 lag_txpd = lag(txpd);
79 if gvkey ne lag(gvkey) then lag_txpd = .;
80 lag2_txpd = lag2(txpd);
81 if gvkey ne lag2(gvkey) then lag2_txpd = .;
82 lag3_txpd = lag3(txpd);
83 if gvkey ne lag3(gvkey) then lag3_txpd = .;
84 lag4_txpd = lag4(txpd);
85 if gvkey ne lag4(gvkey) then lag4_txpd = .;
86 lag5_txpd = lag5(txpd);
87 if gvkey ne lag5(gvkey) then lag5_txpd = .; run;
ERROR: An exception has been encountered.
Please contact technical support and provide them with the following traceback information:
The SAS task name is [DATASTEP]
ERROR: Read Access Violation DATASTEP
Exception occurred at (04937817)
Task Traceback
Address Frame (DBGHELP API Version 4.0 rev 5)
0000000004937817 000000000AB5A1F0 sasxkern:tkvercn1+0x667D7
000000000493BD28 000000000AB5A320 sasxkern:tkvercn1+0x6ACE8
00000000049366B0 000000000AB5A3C0 sasxkern:tkvercn1+0x65670
0000000004B1E4F0 000000000AB5A3C8 sasyh:tkvercn1+0x2D4B0
0000000004B1D750 000000000AB5B040 sasyh:tkvercn1+0x2C710
0000000004B1684B 000000000AB5B210 sasyh:tkvercn1+0x2580B
0000000004AF2EBD 000000000AB5B9A0 sasyh:tkvercn1+0x1E7D
000000000697D6B5 000000000AB5B9A8 sasyoio:tkvercn1+0x1C675
00000000069751A1 000000000AB5F8F0 sasyoio:tkvercn1+0x14161
0000000008459CBC 000000000AB5F8F8 sasdsx:tkvercn1+0x8C7C
0000000008451215 000000000AB5FC20 sasdsx:tkvercn1+0x1D5
00000000068F16A1 000000000AB5FC28 sasds:tkvercn1+0x661
00000000068F1495 000000000AB5FCB0 sasds:tkvercn1+0x455
0000000003478FD7 000000000AB5FCB8 sashost:Main+0xF917
000000000347D5FD 000000000AB5FF50 sashost:Main+0x13F3D
0000000077445A4D 000000000AB5FF58 kernel32:BaseThreadInitThunk+0xD
000000007767B831 000000000AB5FF88 ntdll:RtlUserThreadStart+0x21
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 0.15 seconds
cpu time 0.10 seconds
Have tried using a subset of S2 such as just 5 or 10 records? Does it generate the same error?
What does a Proc Contents show for S2?
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.