Trouble saving permanent dataset

Reply
New Contributor
Posts: 3

Trouble saving permanent dataset

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!!
Trusted Advisor
Posts: 1,475

Re: Trouble saving permanent dataset

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.
 
 

 

Super User
Posts: 7,444

Re: Trouble saving permanent dataset

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
New Contributor
Posts: 3

Re: Trouble saving permanent dataset

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!

Super User
Posts: 7,444

Re: Trouble saving permanent dataset

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
New Contributor
Posts: 3

Re: Trouble saving permanent dataset

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!

Trusted Advisor
Posts: 1,475

Re: Trouble saving permanent dataset

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;

Ask a Question
Discussion stats
  • 6 replies
  • 509 views
  • 0 likes
  • 3 in conversation