BookmarkSubscribeRSS Feed
p_abys
Fluorite | Level 6

I am having trouble saving a permanent file. I have imported the file from spss, which seemed to have worked (all variables and observations were located in the temporary 'work' folder). However when I used the syntax below to save the file permanently into another folder on my desktop, I cannot open the file again after I exit SAS. The following is the error message:
Unable to open the table TMP1.ABEY. TMP1.abey cannot be opened.

It looks like it's saving properly in the folder (I see the SAS file in the folder), it just doesn't open. I've also tried different ways of opening the file- i.e.- double clicking on the dataset icon and trying to open the file directly from SAS.

 
Syntax:
proc import out= work.eating
            DATAFILE= 'C:\Users\dma85\Desktop\Merged_Eatig_Habits\MERGED_EatingHabitsinChildrenwithCP.sav'
            DBMS=SPSS REPLACE;
            run;

libname xyz 'C:\Users\dma85\Desktop\Merged_Eating_Habits';
 
data test;
set xyz.MERGED_EatingHabitsinChildrenwithCP;
run;

data xyz.test;
set test;
run;
 
Thanks!!
6 REPLIES 6
Shmuel
Garnet | Level 18

I see one susspicios line. 

while libname is defined as:   

         libname xyz 'C:\Users\dma85\Desktop\Merged_Eating_Habits';
then line: set xyz.MERGED_EatingHabitsinChildrenwithCP;
probably need be:  set  xyz.inChildrenwithCP;
 
To help you more, please post the log of creating and of saving the dataset permanently.
 
 

 

Kurt_Bremser
Super User

You already imported your file into a SAS dataset. If you want to save the dataset, do

data xyz.eating;
set work.eating;
run;

If you assign the libname first, you can do the import immediately to library xyz.

Although I would not have a SAS library where non-SAS files are stored.

p_abys
Fluorite | Level 6

Thank you both!

 

Kurt, I followed your suggestion, while it opened initially, after I close SAS and try to open the same file again, I get the same error message:

 

Unable to open the table TMP1.eating. TMP1.eating cannot be opened.

 

The log states:  "Format GMFCS not found or couldn't be loaded for variable gmfcs." This is stated for all my variables in the dataset.

 

Still not sure what I'm doing wrong!

Kurt_Bremser
Super User

Make sure that library tmp1 is assigned correctly.

For the format, make sure that it is created in a permanent location (not WORK!) and that the fmtsearch system option points to that location.

p_abys
Fluorite | Level 6

How do I assign tmp1 outside of the temporary 'work' folder? When i save it, it is saved onto a folder on my desktop, so I assume it is in a permanent location since I assign the libname in that location.

 

 

Thanks for you help and patience. I am really new to SAS!

Shmuel
Garnet | Level 18

Any WORK library is canceled when you exit SAS session .

To make a permanent library you need define:

 

LIBNAME  my_lib 'C:/ ...';      /* on WINDOWS - choose library reference name and path */

or

LIBNAME my_lib '/home/ ...';  /* on unix/linux - choose library reference name and path */

 

then create your permanent dataset by:

     DATA my_lib.my_data ;

       set have;

            ...

    RUN;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 6 replies
  • 2666 views
  • 0 likes
  • 3 in conversation