I've made a table in SAS, and there have been no errors. Now, I want to take this table, and make it into a dataset that SAS can use to make graphs, run analysis, etc. I think that this code should go in after the libname statement, but I don't know what to put, or if this is even possible. Could someone take a look at this snippet and tell me if it's possible?
libname ISIS 'SAS-library';
proc sql;
create table WORK.Table1
(IdNum num,
Region char(4),
Country char(3),
Casualties num,
Weapons char(5),
Execution char(1),
Success char(2),
Responsibility char(1));
insert into WORK.Table1
values(201601010005,'MENA','IRA',5,'EXP','N','IS','C')
values(201601010024,'MENA','IRA',28,'EXV','N','IS','C')
values(201601020015,'MENA','IRA',83,'UNK','Y','IS','S')
...
values(201602270009,'MENA','SYR',null,'FIR','N','UN','C')
values(201602270010,'MENA','SYR',2,'EXP','N','IS','S')
values(201602270010,'MENA','SYR',7,'EXV','N','IS','C');
/*Replace semicolon (;) after all values() are inputted*/
title 'ISATT.Table1';
/*Code below is for SAS output */
proc print;
title1 BOLD 'ISIS Data';
title3 ITALIC 'Converted from original data';
title4 ITALIC 'Periods represent null values (composite attacks or unknown casualties)';
footnote1 BOLD 'Codes';
footnote3 'Region: MENA-Middle East/North Africa, WEUR-Western Europe, EEUR-Eastern Europe, NAME-North America, ASIA-Asia, OCEA-Oceana, SSAF-Sub Saharan Africa';
footnote4 'Country: IRA-Iraq, SYR-Syria, LEB-Lebanon, AFG-Afghanistan, TUR-Turkey, USA-United States of America, UKI-United Kingdom, FRA-France, DEU-Germany, RUS-Russia, PHI-Philippines, OTH-Other';
footnote5 'Weapons: EXP-Explosive Device, EXV-Explosive-laden vehicle, FIR-Firearms, OTH-Other, UNK-Unknown';
footnote6 'Execution: Y-Yes, N-No';
footnote7 'Success: IS-ISIS, AT-Anti-terrorism, UN-Unknown';
footnote8 'Responsibility: C-Claimed, S-Suspected';
run;
EDIT: I'm using SAS University Edition running in a virtual environment in VMWare Workstation Player, on Chrome build 65.0.3325.181.
proc sgplot data=ISIS;
Your data set is named TABLE1 not ISIS.
Your library is ISIS according to your libname statement.
A library is a folder that stores your data sets.
Dataset work.table1 is immediately available for further processing after you create it with proc sql.
According to your code, isis is a library, not a dataset.
So you have an error in how you try to access your newly created dataset.
Post your code.
Code is above in OP.
There is NO place in that code where you try to access work.isis, so the log can't come from it. Post your real code that caused the error, or still better, the whole log.
The log is below. Sorry, I'm just starting out in SAS, and am not really familiar with it. 😞
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
NOTE: ODS statements in the SAS Studio environment may disable some output features.
73
74 libname ISIS 'SAS-library';
NOTE: Library ISIS does not exist.
75
76 proc sql;
77
78 create table WORK.Table1
79 (IdNum num,
80 Region char(4),
81 Country char(3),
82 Casualties num,
83 Weapons char(5),
84 Execution char(1),
85 Success char(2),
86 Responsibility char(1));
NOTE: Table WORK.TABLE1 created, with 0 rows and 8 columns.
87
88 insert into WORK.Table1
89 values(201601010005,'MENA','IRA',5,'EXP','N','IS','C')
90 values(201601010024,'MENA','IRA',28,'EXV','N','IS','C')
91 values(201601020015,'MENA','IRA',83,'UNK','Y','IS','S')
92 values(201601020016,'MENA','IRA',10,'EXP','N','IS','C')
93 values(201601030006,'MENA','IRA',18,'EXP','N','IS','C')
94 values(201601030007,'MENA','IRA',0,'EXP','N','IS','S')
95 values(201601030008,'MENA','IRA',0,'EXP','N','IS','S')
96 values(201601030009,'MENA','IRA',0,'EXP','N','IS','S')
97 values(201601030020,'MENA','IRA',9,'FIR','N','AT','S')
98 values(201601030021,'MENA','IRA',13,'EXV','N','AT','C')
99 values(201601030022,'MENA','IRA',null,'UNK','N','UN','C')
100 values(201601030023,'MENA','IRA',null,'UNK','N','UN','C')
101 values(201601030024,'MENA','IRA',5,'EXP','N','IS','C')
102 values(201601030027,'MENA','IRA',18,'UNK','Y','IS','S')
103 values(201601030028,'MENA','IRA',3,'UNK','N','AT','S')
104 values(201601030040,'MENA','IRA',3,'EXP','N','IS','C')
105 values(201601040046,'MENA','IRA',141,'EXV','N','AT','C')
106 values(201601050008,'MENA','IRA',5,'EXP','N','IS','C')
107 values(201601050009,'MENA','IRA',10,'EXP','N','IS','C')
108 values(201601050018,'MENA','IRA',null,'EXV','N','IS','C')
109 values(201601050047,'MENA','IRA',6,'EXV','N','IS','C')
110 values(201601060001,'MENA','SYR',7,'UNK','N','AT','S')
111 values(201601060030,'MENA','IRA',5,'FIR','N','IS','C')
112 values(201601060040,'MENA','SYR',1,'UNK','Y','IS','S')
113 values(201601070025,'WEUR','FRA',1,'OTH','N','AT','S')
114 values(201601070027,'MENA','IRA',null,'OTH','N','AT','S')
115 values(201601070032,'MENA','IRA',6,'UNK','Y','IS','S')
116 values(201601070046,'MENA','IRA',2,'UNK','N','AT','S')
117 values(201601080016,'MENA','LEB',2,'FIR','N','IS','S')
118 values(201601090022,'MENA','IRA',12,'UNK','Y','IS','S')
119 values(201601090024,'MENA','IRA',17,'UNK','N','AT','S')
120 values(201601090025,'MENA','IRA',null,'OTH','Y','IS','S')
121 values(201601100018,'MENA','IRA',1,'UNK','N','IS','S')
122 values(201601100034,'MENA','IRA',0,'EXP','N','AT','S')
123 values(201601110006,'MENA','IRA',3,'EXP','N','IS','C')
124 values(201601110019,'MENA','IRA',1,'UNK','Y','IS','S')
125 values(201601110021,'ASIA','PHI',0,'0TH','N','AT','S')
126 values(201601110023,'WEUR','FRA',1,'OTH','N','UN','S')
127 values(201601110026,'MENA','IRA',71,'EXP','Y','IS','C')
128 values(201601110027,'MENA','IRA',71,'EXP','N','IS','C')
129 values(201601110028,'MENA','IRA',71,'EXP','N','IS','C')
130 values(201601110030,'MENA','IRA',11,'EXV','N','IS','C')
131 values(201601110032,'MENA','IRA',17,'EXP','N','IS','C')
132 values(201601120001,'MENA','TUR',25,'EXP','N','IS','S')
133 values(201601120019,'MENA','IRA',4,'EXV','N','IS','C')
134 values(201601120038,'MENA','IRA',3,'EXP','N','IS','C')
135 values(201601120043,'MENA','IRA',25,'EXV','N','AT','S')
136 values(201601130044,'MENA','IRA',4,'UNK','N','IS','S')
137 values(201601130054,'MENA','IRA',3,'EXV','N','IS','C')
138 values(201601140023,'MENA','IRA',13,'EXV','N','IS','C')
139 values(201601140024,'MENA','IRA',3,'EXV','N','IS','C')
140 values(201601140032,'MENA','IRA',4,'EXP','N','IS','C')
141 values(201601140050,'MENA','LEB',4,'EXP','N','IS','C')
142 values(201601150040,'NAME','USA',1,'OTH','N','AT','S')
143 values(201601150049,'MENA','IRA',19,'UNK','Y','IS','S')
144 values(201601150067,'MENA','IRA',17,'EXP','N','IS','C')
145 values(201601150072,'MENA','SYR',5,'EXP','N','IS','C')
146 values(201601150079,'MENA','SYR',2,'UNK','Y','IS','S')
147 values(201601160002,'MENA','SYR',577,'EXV','Y','IS','C')
148 values(201601160003,'MENA','SYR',null,'EXV','Y','IS','C')
149 values(201601160004,'MENA','SYR',null,'EXV','Y','IS','C')
150 values(201601160005,'MENA','SYR',null,'EXV','Y','IS','C')
151 values(201601160006,'MENA','SYR',null,'EXV','Y','IS','C')
152 values(201601160007,'MENA','SYR',null,'EXV','Y','IS','C')
153 values(201601160008,'MENA','SYR',null,'EXV','Y','IS','C')
154 values(201601160009,'MENA','SYR',null,'EXV','Y','IS','C')
155 values(201601160010,'MENA','SYR',null,'EXV','Y','IS','C')
156 values(201601160011,'MENA','SYR',null,'EXV','Y','IS','C')
157 values(201601160012,'MENA','SYR',null,'EXV','Y','IS','C')
158 values(201601160013,'MENA','SYR',null,'EXV','Y','IS','C')
159 values(201601170029,'MENA','IRA',10,'UNK','N','AT','S')
160 values(201601180023,'MENA','TUR',3,'EXP','N','IS','S')
161 values(201601180037,'MENA','IRA',3,'FIR','N','IS','C')
162 values(201601190031,'MENA','SYR',50,'UNK','Y','UN','C')
163 values(201601190038,'MENA','IRA',2,'UNK','Y','IS','S')
164 values(201601200030,'MENA','IRA',3,'EXP','N','AT','S')
165 values(201601230023,'MENA','IRA',46,'EXV','N','IS','C')
166 values(201601230028,'MENA','IRA',32,'EXV','N','AT','C')
167 values(201601230031,'MENA','IRA',7,'UNK','N','AT','S')
168 values(201601230034,'MENA','IRA',0,'EXP','N','UN','S')
169 values(201601230035,'MENA','IRA',0,'EXP','N','UN','S')
170 values(201601230042,'MENA','IRA',9,'UNK','N','AT','S')
171 values(201601230043,'MENA','IRA',null,'UNK','N','AT','S')
172 values(201601240017,'MENA','SYR',23,'EXP','N','IS','C')
173 values(201601240018,'MENA','SYR',0,'EXP','N','UN','C')
174 values(201601240028,'MENA','IRA',8,'EXP','N','IS','C')
175 values(201601240030,'MENA','IRA',7,'EXP','N','IS','C')
176 values(201601240034,'MENA','IRA',3,'UNK','Y','UN','C')
177 values(201601250023,'MENA','SYR',24,'EXV','N','IS','S')
178 values(201601250031,'MENA','SYR',11,'OTH','N','IS','S')
179 values(201601250032,'MENA','SYR',null,'OTH','N','IS','S')
180 values(201601260005,'MENA','SYR',125,'EXV','N','IS','C')
181 values(201601260006,'MENA','SYR',null,'EXV','N','IS','C')
182 values(201601260028,'MENA','IRA',1,'EXV','N','AT','S')
183 values(201601260029,'MENA','IRA',4,'EXP','N','IS','C')
184 values(201601260031,'MENA','IRA',6,'EXP','N','AT','S')
185 values(201601260038,'MENA','IRA',30,'EXV','N','IS','S')
186 values(201601260039,'MENA','IRA',37,'EXV','N','IS','S')
187 values(201601270032,'MENA','IRA',26,'EXP','N','IS','C')
188 values(201601270033,'MENA','IRA',50,'UNK','Y','UN','S')
189 values(201601280038,'MENA','IRA',128,'EXV','N','UN','S')
190 values(201601280044,'MENA','TUR',0,'FIR','N','AT','S')
191 values(201601290001,'MENA','OTH',39,'EXP','N','IS','S')
192 values(201601290017,'MENA','IRA',null,'EXV','N','AT','S')
193 values(201601300041,'MENA','IRA',21,'UNK','N','IS','S')
194 values(201601310015,'MENA','SYR',171,'EXV','N','IS','C')
195 values(201601310015,'MENA','SYR',null,'EXP','N','IS','C')
196 values(201601310045,'MENA','IRA',6,'UNK','N','AT','S')
197 values(201601260053,'MENA','IRA',10,'UNK','Y','IS','S')
198 values(201602010016,'MENA','IRA',48,'EXV','N','IS','S')
199 values(201602010045,'MENA','IRA',null,'UNK','N','AT','S')
200 values(201602020016,'MENA','IRA',0,'EXV','N','UN','S')
201 values(201602020019,'MENA','IRA',0,'EXV','N','AT','S')
202 values(201602020022,'MENA','SYR',4,'EXP','N','IS','S')
203 values(201602020042,'MENA','IRA',21,'EXV','N','UN','S')
204 values(201602020043,'MENA','IRA',14,'EXV','N','AT','S')
205 values(201602030048,'MENA','IRA',9,'EXP','N','IS','S')
206 values(201602030049,'MENA','IRA',6,'EXP','N','IS','S')
207 values(201602030068,'MENA','TUR',0,'EXP','N','UN','S')
208 values(201602030069,'MENA','TUR',null,'EXP','N','UN','S')
209 values(201602030070,'MENA','TUR',null,'EXP','N','UN','S')
210 values(201602030071,'MENA','TUR',0,'FIR','N','AT','S')
211 values(201602040027,'MENA','IRA',30,'EXV','N','IS','S')
212 values(201602040028,'MENA','IRA',null,'EXV','N','IS','S')
213 values(201602040029,'MENA','IRA',4,'EXP','N','IS','S')
214 values(201602050004,'MENA','IRA',8,'EXP','N','AT','C')
215 values(201602050013,'MENA','IRA',17,'UNK','N','IS','C')
216 values(201602050014,'MENA','IRA',30,'UNK','N','AT','C')
217 values(201602050053,'MENA','IRA',16,'EXP','N','IS','C')
218 values(201602050074,'WEUR','DEU',0,'EXP','N','AT','S')
219 values(201602060007,'MENA','IRA',33,'FIR','N','AT','S')
220 values(201602060008,'MENA','IRA',2,'EXV','N','AT','S')
221 values(201602060029,'MENA','IRA',56,'EXV','N','AT','C')
222 values(201602060058,'MENA','IRA',26,'EXV','N','IS','S')
223 values(201602060060,'MENA','IRA',null,'EXV','N','IS','S')
224 values(201602060061,'MENA','IRA',null,'EXV','N','IS','S')
225 values(201602070007,'MENA','IRA',10,'EXP','N','IS','C')
226 values(201602070019,'MENA','IRA',null,'UNK','Y','IS','S')
227 values(201602070020,'MENA','IRA',300,'UNK','Y','IS','S')
228 values(201602080013,'MENA','IRA',35,'UNK','Y','IS','S')
229 values(201602090002,'MENA','SYR',29,'EXV','N','AT','C')
230 values(201602090032,'MENA','IRA',11,'UNK','N','AT','S')
231 values(201602100007,'MENA','IRA',8,'EXV','N','IS','C')
232 values(201602100030,'MENA','IRA',1,'UNK','Y','IS','S')
233 values(201602100041,'MENA','IRA',24,'EXV','N','AT','C')
234 values(201602110008,'MENA','IRA',0,'OTH','N','AT','S')
235 values(201602110009,'MENA','IRA',9,'UNK','N','IS','S')
236 values(201602110023,'NAME','USA',5,'OTH','N','AT','S')
237 values(201602130009,'MENA','IRA',6,'EXP','N','IS','C')
238 values(201602130010,'MENA','IRA',4,'EXP','N','AT','C')
239 values(201602130011,'MENA','IRA',null,'UNK','Y','IS','S')
240 values(201602140006,'MENA','IRA',2,'UNK','Y','IS','S')
241 values(201602150024,'MENA','IRA',0,'UNK','N','AT','S')
242 values(201602150026,'MENA','IRA',2,'UNK','Y','IS','S')
243 values(201602150041,'MENA','IRA',null,'EXV','N','AT','C')
244 values(201602150042,'MENA','IRA',5,'EXP','N','AT','S')
245 values(201602150052,'MENA','OTH',1,'FIR','N','AT','C')
246 values(201602160031,'MENA','IRA',0,'EXV','N','AT','S')
247 values(201602160032,'MENA','IRA',null,'EXV','N','AT','S')
248 values(201602170001,'MENA','TUR',89,'EXV','N','IS','S')
249 values(201602180012,'MENA','IRA',10,'EXP','N','IS','C')
250 values(201602180028,'MENA','IRA',4,'EXV','N','AT','S')
251 values(201602180029,'MENA','IRA',6,'EXP','N','AT','S')
252 values(201602180030,'MENA','IRA',2,'FIR','N','IS','C')
253 values(201602180032,'MENA','IRA',17,'UNK','Y','IS','S')
254 values(201602180034,'MENA','IRA',14,'UNK','N','AT','S')
255 values(201602180035,'MENA','IRA',3,'UNK','Y','IS','S')
256 values(201602180054,'MENA','IRA',null,'UNK','N','IS','C')
257 values(201602180062,'WEUR','UKI',1,'OTH','N','UN','S')
258 values(201602190049,'MENA','IRA',10,'UNK','Y','IS','S')
259 values(201602200023,'MENA','IRA',4,'EXV','N','AT','C')
260 values(201602200024,'MENA','IRA',14,'EXV','N','IS','C')
261 values(201602210001,'MENA','SYR',268,'EXV','N','IS','C')
262 values(201602210002,'MENA','SYR',null,'EXV','N','IS','C')
263 values(201602210003,'MENA','SYR',136,'EXV','N','IS','C')
264 values(201602210013,'MENA','SYR',1,'EXV','N','AT','S')
265 values(201602210024,'MENA','IRA',5,'EXP','N','IS','S')
266 values(201602210030,'MENA','IRA',5,'EXV','N','AT','S')
267 values(201602210060,'MENA','SYR',268,'EXP','N','IS','C')
268 values(201602220027,'MENA','IRA',15,'UNK','N','IS','C')
269 values(201602220028,'MENA','IRA',null,'EXV','N','AT','S')
270 values(201602220044,'MENA','IRA',null,'EXV','N','IS','C')
271 values(201602220044,'MENA','IRA',null,'FIR','N','IS','C')
272 values(201602230026,'MENA','IRA',null,'UNK','N','AT','S')
273 values(201602230027,'MENA','IRA',12,'UNK','Y','IS','S')
274 values(201602230028,'MENA','IRA',9,'EXP','N','AT','S')
275 values(201602230029,'MENA','IRA',4,'UNK','Y','IS','S')
276 values(201602240017,'MENA','IRA',3,'UNK','N','AT','S')
277 values(201602240018,'MENA','IRA',0,'UNK','N','AT','S')
278 values(201602240019,'MENA','IRA',0,'EXP','N','IS','S')
279 values(201602240020,'MENA','IRA',null,'EXP','N','IS','S')
280 values(201602240021,'MENA','IRA',null,'EXP','N','IS','S')
281 values(201602240022,'MENA','IRA',null,'EXP','N','IS','S')
282 values(201602240023,'MENA','IRA',null,'EXP','N','IS','S')
283 values(201602240024,'MENA','IRA',null,'EXP','N','IS','S')
284 values(201602240025,'MENA','IRA',null,'EXP','N','IS','S')
285 values(201602240026,'MENA','IRA',null,'EXP','N','IS','S')
286 values(201602240027,'MENA','IRA',null,'EXP','N','IS','S')
287 values(201602240028,'MENA','IRA',null,'EXP','N','IS','S')
288 values(201602240029,'MENA','IRA',null,'EXP','N','IS','S')
289 values(201602240030,'MENA','IRA',null,'EXP','N','IS','S')
290 values(201602240031,'MENA','IRA',null,'EXP','N','IS','S')
291 values(201602240032,'MENA','IRA',null,'EXP','N','IS','S')
292 values(201602240033,'MENA','IRA',null,'EXP','N','IS','S')
293 values(201602240034,'MENA','IRA',null,'EXP','N','IS','S')
294 values(201602240035,'MENA','IRA',null,'EXP','N','IS','S')
295 values(201602240036,'MENA','IRA',null,'EXP','N','IS','S')
296 values(201602240037,'MENA','IRA',null,'EXP','N','IS','S')
297 values(201602240038,'MENA','IRA',null,'EXP','N','IS','S')
298 values(201602250019,'MENA','IRA',20,'EXP','N','IS','C')
299 values(201602250020,'MENA','IRA',45,'EXP','N','IS','C')
300 values(201602250025,'MENA','IRA',null,'EXP','N','IS','S')
301 values(201602260044,'WEUR','DEU',1,'OTH','N','AT','S')
302 values(201602270009,'MENA','SYR',null,'FIR','N','UN','C')
303 values(201602270010,'MENA','SYR',2,'EXP','N','IS','S')
304 values(201602270010,'MENA','SYR',7,'EXV','N','IS','C');
NOTE: 216 rows were inserted into WORK.TABLE1.
305
306 /*Replace semicolon (;) after all values() are inputted*/
307
308 title 'ISATT.Table1';
309
310 /*Code below is for SAS output */
NOTE: PROCEDURE SQL used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
311 proc print;
312
313 title1 BOLD 'ISIS Data';
314 title3 ITALIC 'Converted from original data';
315 title4 ITALIC 'Periods represent null values (composite attacks or unknown casualties)';
316 footnote1 BOLD 'Codes';
317 footnote3 'Region: MENA-Middle East/North Africa, WEUR-Western Europe, EEUR-Eastern Europe, NAME-North America,
317 ! ASIA-Asia, OCEA-Oceana, SSAF-Sub Saharan Africa';
318 footnote4 'Country: IRA-Iraq, SYR-Syria, LEB-Lebanon, AFG-Afghanistan, TUR-Turkey, USA-United States of America,
318 ! UKI-United Kingdom, FRA-France, DEU-Germany, RUS-Russia, PHI-Philippines, OTH-Other';
319 footnote5 'Weapons: EXP-Explosive Device, EXV-Explosive-laden vehicle, FIR-Firearms, OTH-Other, UNK-Unknown';
320 footnote6 'Execution: Y-Yes, N-No';
321 footnote7 'Success: IS-ISIS, AT-Anti-terrorism, UN-Unknown';
322 footnote8 'Responsibility: C-Claimed, S-Suspected';
323
324 run;
NOTE: Font specification "Albany AMT, Albany AMT" failed. Using default font family instead.
NOTE: There were 216 observations read from the data set WORK.TABLE1.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.78 seconds
cpu time 0.78 seconds
325
326 /*Code below is for graph generation; use SAS paper 154-2010*/
327 proc sgplot data=ISIS;
ERROR: File WORK.ISIS.DATA does not exist.
328 VBAR region;
ERROR: No data set open to look up variables.
329 TITLE 'Attacks by Region';
330 run;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SGPLOT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
331
332 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
345
proc print;
You should always include a DATA statement in your process so its exactly clear what you're running.
What happens if you run the following code:
proc print data=table1 (obs=20) noobs label; run;
proc sgplot data=ISIS;
Your data set is named TABLE1 not ISIS.
Your library is ISIS according to your libname statement.
A library is a folder that stores your data sets.
No, you likely did something incorrectly is more likely.
I've never seen that behaviour with code correctly written.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.