DATA Step, Macro, Functions and more

libname

Reply
Contributor
Posts: 20

libname

I checked everything but have no clue.  the location is 200% correct.  see below copy and paste from SAS studio location.

/home/coccus030/sasuser.v94/institutiondata.txt

 

My code:

libname Lesson08 '/home/coccus030/sasuser.v94/institutiondata.txt';
Data Lesson08.college09ds;
Infile '/home/coccus030/sasuser.v94/institutiondata.txt.Lesson08' firstobs=2;
Input GenderType & $6. +1 Year +1 Total comma5. Asofdate Gender $ Instituion $;
run;

error log:

libname Lesson08 '/home/coccus030/sasuser.v94/institutiondata.txt';

ERROR: Library LESSON08 is not in a valid format for access method RANDOM.
ERROR: Error in the LIBNAME statement.
72 Data Lesson08.college09ds;
73 Infile '/home/coccus030/sasuser.v94/institutiondata.txt.Lesson08' firstobs=2;
74 Input GenderType & $6. +1 Year +1 Total comma5. Asofdate Gender $ Instituion $;
75 run;
 
ERROR: Libref LESSON08 is not assigned.
 
thx
Super User
Posts: 9,594

Re: libname

Your libname is 200% bogus.

A libname for a Base SAS library does not point to a file, but to a directory.

Only some special engines (like Excel) point to files.

 

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Contributor
Posts: 20

Re: libname

Posted in reply to KurtBremser

Thanks Kurt 

 

I still not sure why not read. 

 

 

Trusted Advisor
Posts: 1,826

Re: libname

Try:

FILENAME Lesson08   '/home/coccus030/sasuser.v94/institutiondata.txt.Lesson08';
LIBNAME mylib       '/home/coccus030/sasuser.v94';

Data MYLIB.college09ds;
Infile Lesson08 firstobs=2;
Input GenderType & $6. +1 Year +1 Total comma5. Asofdate Gender $ Instituion $;
run;

Without having your input file I cant verify that code.

Contributor
Posts: 20

Re: libname

Not working neither  same error message pop up with mylib.

 

 

this is the input file but I have to check this part yet because the libname and infile not work.

 

 

Variables: GenderType Year Total Asofdate
ihe-M 1970 5,044 Retrieved: 03/14/2012 f-IHE 1970  3,537 Retrieved: 03/14/2012
ihe-m 1980 5,874 Retrieved: 03/14/2012 f-IHE 1980  6,223 Retrieved: 03/14/2012
ihe-M 1990 6,284 Retrieved: 03/14/2012 F-IHE 1990  7,535 Retrieved: 03/14/2012
dgi-M 2000 6,722 Retrieved: 03/14/2012 f-dgi 2000  8,591 Retrieved: 03/14/2012
dgi-m 2001 6,961 Retrieved: 03/14/2012 f-dgi 2001  8,967 Retrieved: 03/14/2012
DGI-m 2002 7,202 Retrieved: 03/14/2012 f-dgi 2002  9,410 Retrieved: 03/14/2012
dgi-M 2003 7,260 Retrieved: 03/14/2012 F-DGI 2003  9,651 Retrieved: 03/14/2012
dgi-M 2004 7,387 Retrieved: 03/14/2012 F-DGI 2004  9,885 Retrieved: 03/14/2012
dgi-m 2005 7,456 Retrieved: 03/14/2012 f-DGI 2005 10,032 Retrieved: 03/14/2012
DGI-m 2006 7,575 Retrieved: 03/14/2012 f-dgi 2006 10,184 Retrieved: 03/14/2012
dgi-M 2007 7,816 Retrieved: 03/14/2012 f-dgi 2007 10,432 Retrieved: 03/14/2012
dgi-M 2008 8,189 Retrieved: 03/14/2012 F-DGI 2008 10,914 Retrieved: 03/14/2012
DGI-m 2009 8,770 Retrieved: 03/14/2012 F-dgi 2009 11,658 Retrieved: 03/14/2012

Trusted Advisor
Posts: 1,826

Re: libname

Saying "libname and infile not work." - is not enough.

To help you we need the full log.

Ask a Question
Discussion stats
  • 5 replies
  • 99 views
  • 0 likes
  • 3 in conversation