data Merge1;
merge Airbag.ctl Alignmt.ctl;
by Report_Number;
run;
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
Moses
You are specifying your table names as libraries and your library as the table name.
I assume you want:
data Merge1;
merge ctl.Airbag ctl.Alignmt;
by Report_Number;
run;
No this doesnt work. It now says "Libref CTL is not assigned
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;
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.
Please attached is my full screen. I am very new using SAS,trying to learn by myself and this is my very first task I am trying to perform, so I need help and direction,
Thanaks
Sorry, opening attachment files is a security risk. I would recommend you follow the SAS video training:
http://support.sas.com/training/tutorial/
As this will explain things - assigning libraries is pretty much learning step 1.
ok thank you
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.
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.
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.
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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.