When importing a .csv file using the Enterprise Guide import data wizard, I am receiving the following two errors (below line 23 in the code below). I'm a newbie to SAS and use Enterprise Guide because my coding skills are quite low. Thank you in advance for your help.
1 The SAS System 10:26 Thursday, May 31, 2018
1 ;*';*";*/;quit;run;
2 OPTIONS PAGENO=MIN;
3 /* --------------------------------------------------------------------
4 Code generated by a SAS task
5
6 Generated on Thursday, May 31, 2018 at 10:57:22 AM
7 By task: Import Data Wizard
8
9 Source file: C:\Users\fact4833\Documents\My SAS Files\DP1800 SAS
10 Files and Work\Combined 2014 HRS Files.csv
11 Server: Local File System
12
13 Output data: WORK.COMBINED 2014 HRS FILES_0003
14 Server: Local
15 -------------------------------------------------------------------- */
16
17 /* --------------------------------------------------------------------
18 This DATA step reads the data values from DATALINES within the SAS
19 code. The values within the DATALINES were extracted from the text
20 source file by the Import Data wizard.
21 -------------------------------------------------------------------- */
22
23 DATA WORK.COMBINED 2014 HRS FILES_0003;
____
22
200
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, (, /, ;, _DATA_, _LAST_, _NULL_.
ERROR 200-322: The symbol is not recognized and will be ignored.
24 LENGTH
25 HHIDPN 8
26 HHID 8
27 PN 8
28 'OB000 Life Satisfaction'n 8
29 'Life Completely Satisfied'n 8
30 'Life Very Satisfied'n 8
31 'Life Somewhat Satisfied'n 8
32 'Life Not Very Satisfied'n 8
33 'Life Not At All Satisfied'n 8
34 'OB028 Hispanic Latino'n 8
35 'OB089M1M Race'n 8
36 'OE056 Give 5k in past 10 Yrs'n 8
37 'OE060 100 Hrs + of GC Care'n 8
38 'OE063 Hrs GC Care'n 8
39 'Grandchild lives in home'n 8
40 'OE068 Hrs Sps GC Care'n 8
41 'Spouses GC lives in home'n 8
42 'Grandchild Lives in Home_0001'n 8
43 'OJ478 Currently Rec SS'n 8
44 'OJ480 Age expect to take SS'n 8
45 OJ481 8
46 OJ485 8
47 'Expected SS Value'n 8
48 'OX060R Male'n 8
49 Female 8
50 'OX065R Married or Partnered'n 8
51 'OX067R Year Born'n 8
2 The SAS System 10:26 Thursday, May 31, 2018
52 'Age at end of 2018'n 8
53 'OV368 Family w Alcohol Prob'n 8
54 'OV369 Family w Drug Prob'n 8 ;
55 LABEL
56 'Grandchild Lives in Home_0001'n = "Grandchild Lives in Home" ;
57 FORMAT
58 HHIDPN BEST9.
59 HHID BEST6.
60 PN BEST2.
61 'OB000 Life Satisfaction'n BEST1.
62 'Life Completely Satisfied'n BEST1.
63 'Life Very Satisfied'n BEST1.
64 'Life Somewhat Satisfied'n BEST1.
65 'Life Not Very Satisfied'n BEST1.
66 'Life Not At All Satisfied'n BEST1.
67 'OB028 Hispanic Latino'n BEST1.
68 'OB089M1M Race'n BEST2.
69 'OE056 Give 5k in past 10 Yrs'n BEST1.
70 'OE060 100 Hrs + of GC Care'n BEST1.
71 'OE063 Hrs GC Care'n BEST5.
72 'Grandchild lives in home'n BEST1.
73 'OE068 Hrs Sps GC Care'n BEST5.
74 'Spouses GC lives in home'n BEST1.
75 'Grandchild Lives in Home_0001'n BEST1.
76 'OJ478 Currently Rec SS'n BEST1.
77 'OJ480 Age expect to take SS'n BEST2.
78 OJ481 BEST5.
79 OJ485 BEST1.
80 'Expected SS Value'n BEST5.
81 'OX060R Male'n BEST1.
82 Female BEST1.
83 'OX065R Married or Partnered'n BEST1.
84 'OX067R Year Born'n BEST4.
85 'Age at end of 2018'n BEST3.
86 'OV368 Family w Alcohol Prob'n BEST1.
87 'OV369 Family w Drug Prob'n BEST1. ;
88 INFORMAT
89 HHIDPN BEST9.
90 HHID BEST6.
91 PN BEST2.
92 'OB000 Life Satisfaction'n BEST1.
93 'Life Completely Satisfied'n BEST1.
94 'Life Very Satisfied'n BEST1.
95 'Life Somewhat Satisfied'n BEST1.
96 'Life Not Very Satisfied'n BEST1.
97 'Life Not At All Satisfied'n BEST1.
98 'OB028 Hispanic Latino'n BEST1.
99 'OB089M1M Race'n BEST2.
100 'OE056 Give 5k in past 10 Yrs'n BEST1.
101 'OE060 100 Hrs + of GC Care'n BEST1.
102 'OE063 Hrs GC Care'n BEST5.
103 'Grandchild lives in home'n BEST1.
104 'OE068 Hrs Sps GC Care'n BEST5.
105 'Spouses GC lives in home'n BEST1.
106 'Grandchild Lives in Home_0001'n BEST1.
107 'OJ478 Currently Rec SS'n BEST1.
108 'OJ480 Age expect to take SS'n BEST2.
109 OJ481 BEST5.
3 The SAS System 10:26 Thursday, May 31, 2018
110 OJ485 BEST1.
111 'Expected SS Value'n BEST5.
112 'OX060R Male'n BEST1.
113 Female BEST1.
114 'OX065R Married or Partnered'n BEST1.
115 'OX067R Year Born'n BEST4.
116 'Age at end of 2018'n BEST3.
117 'OV368 Family w Alcohol Prob'n BEST1.
118 'OV369 Family w Drug Prob'n BEST1. ;
119 INFILE DATALINES4
120 DLM='7F'x
121 MISSOVER
122 DSD ;
123 INPUT
124 HHIDPN : ?? BEST9.
125 HHID : ?? BEST6.
126 PN : ?? BEST2.
127 'OB000 Life Satisfaction'n : ?? BEST1.
128 'Life Completely Satisfied'n : ?? BEST1.
129 'Life Very Satisfied'n : ?? BEST1.
130 'Life Somewhat Satisfied'n : ?? BEST1.
131 'Life Not Very Satisfied'n : ?? BEST1.
132 'Life Not At All Satisfied'n : ?? BEST1.
133 'OB028 Hispanic Latino'n : ?? BEST1.
134 'OB089M1M Race'n : ?? BEST2.
135 'OE056 Give 5k in past 10 Yrs'n : ?? BEST1.
136 'OE060 100 Hrs + of GC Care'n : ?? BEST1.
137 'OE063 Hrs GC Care'n : ?? BEST5.
138 'Grandchild lives in home'n : ?? BEST1.
139 'OE068 Hrs Sps GC Care'n : ?? BEST5.
140 'Spouses GC lives in home'n : ?? BEST1.
141 'Grandchild Lives in Home_0001'n : ?? BEST1.
142 'OJ478 Currently Rec SS'n : ?? BEST1.
143 'OJ480 Age expect to take SS'n : ?? BEST2.
144 OJ481 : ?? BEST5.
145 OJ485 : ?? BEST1.
146 'Expected SS Value'n : ?? BEST5.
147 'OX060R Male'n : ?? BEST1.
148 Female : ?? BEST1.
149 'OX065R Married or Partnered'n : ?? BEST1.
150 'OX067R Year Born'n : ?? BEST4.
151 'Age at end of 2018'n : ?? BEST3.
152 'OV368 Family w Alcohol Prob'n : ?? BEST1.
153 'OV369 Family w Drug Prob'n : ?? BEST1. ;
154 DATALINES4;
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.COMBINED may be incomplete. When this step was stopped there were 0 observations and 30 variables.
WARNING: Data set WORK.COMBINED was not replaced because this step was stopped.
WARNING: The data set WORK.HRS may be incomplete. When this step was stopped there were 0 observations and 30 variables.
WARNING: Data set WORK.HRS was not replaced because this step was stopped.
WARNING: The data set WORK.FILES_0003 may be incomplete. When this step was stopped there were 0 observations and 30 variables.
NOTE: DATA statement used (Total process time):
real time 0.06 seconds
cpu time 0.07 seconds
13394 ;;;;
4 The SAS System 10:26 Thursday, May 31, 2018
13395
13396
13397 QUIT; RUN;
13398
Bless you! Many thanks.
The table name is not a valid SAS name. You can enclose it in SAS "literal syntax" to reference it:
DATA "COMBINED 2014 HRS FILES_0003"n
Or simply name the output file something simpler, with no spaces or special characters in the name.
Thanks so much Chris. Much appreciated.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.