03-13-2017 12:44 PM
merge Airbag.ctl Alignmt.ctl;
Am trying to merge the datasets Airbag and Alignmt but I received the following error messages
ERROR: Libref AIRBAG is not assigned
ERROR: Libref ALIGNMT is not assigned
03-13-2017 01:01 PM
The log error tells you everything you need to know, you have no libraries setup for those two references. A libname is a container for other files such as datasets, and you assign these by:
libname <reference> "<network path to files>"; e.g. libname mine "c;\myfolder"; This creates a library reference mine, pointing to that path. And you can use this to reference datasets witihn that folder by: data want; set <reference>.<dataset>; run;
03-20-2017 03:08 AM
Thank you. Eventually, this is what I did after watching some videos from Techsupport. I created a libref and that solved the problem, and I was able to merge. Thank you. But another problem emerged. The ID column that I am merging by, has multiple data in some of the tables. So when I sort the data SAS tells me that the tables are not well sorted and it stops after reading less that half of the rows.
03-13-2017 01:18 PM
Sorry, opening attachment files is a security risk. I would recommend you follow the SAS video training:
As this will explain things - assigning libraries is pretty much learning step 1.
03-20-2017 03:12 AM
Thank you. Watching the tutorial helped. I created the libref and it worked. But only few rows were merged because SAS could not sort the data correctly. The ID column that I am merging by, has repeated names in most of the rows. So when I sort the data SAS gives an error message that the tables are not well sorted.
03-13-2017 03:00 PM
I understand that Airbag and Alignment are two sas datasets.
Are they in a subdirectory named ctl ?
If yes - add a line ahead of your code:
libname ctl "...path to the subdirectory ...";
then use datasetst as: ctl.Airbag, ctl.Alignment.
03-20-2017 03:14 AM
I performed the merge after watching some tutorial videos on creating libref. I created the libref and it worked. But only few rows were merged because SAS could not sort the data correctly. The ID column that I am merging by, has repeated names in most of the rows. So when I sort the data SAS gives an error message that the tables are not well sorted.
03-13-2017 03:24 PM
Looks like you're using SAS UE. Try the following (although you may have to first sort all of those files by Report_Number) and I may have misspelled some of your file names:
libname ctl "/folders/myfolders"; data merge1; merge ctl.airbag ctl.alignment ctl.driver ctl crashcha ctl.inserty ctl.speed ctl.weather; by Report_Number; run;
Art, CEO, AnalystFinder.com