BookmarkSubscribeRSS Feed
mtefe
Calcite | Level 5
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

 

 

11 REPLIES 11
collinelliot
Barite | Level 11

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;

 

 

mtefe
Calcite | Level 5

No this doesnt work. It now says "Libref CTL is not assigned

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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;

mtefe
Calcite | Level 5

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.

mtefe
Calcite | Level 5

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

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

mtefe
Calcite | Level 5

ok thank you

mtefe
Calcite | Level 5

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.

Shmuel
Garnet | Level 18

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.

mtefe
Calcite | Level 5

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.

art297
Opal | Level 21

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

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 11 replies
  • 1441 views
  • 0 likes
  • 5 in conversation