05-23-2017 02:03 PM
I am using a DATA step to create a new, permanent SAS dataset from a .csv file.
The log indicates the dataset was successfully created: "NOTE: The data set SURVEY.CSCSP_2016 has 2864 observations and 141 variables." The dataset appears in the SURVEY library.
When I run a PROC CONTENTS on the newly created dataset, it disappears from the SURVEY library and the Log states: " ERROR: File SURVEY.CSCSP_2016.DATA does not exist."
I have never experienced this before. Any clues?
PROC CONTENTS DATA=survey.cscsp_2016 VARNUM;
05-24-2017 11:45 PM
Note that when you show the datasets in the library it didn't disappear, it was renamed somehow with a 2 and then a 3, which means it thinks you already have a copy in that folder somewhere. I think that it's only working when you run once is timing - before the rename happens.
And once that 2 is there it's not a valid SAS name which may be why it's not showing up in the library. You could try changing VALIDVARNAME option to see it shows up in the library.
I don't know what's causing it to create that 2/3. Did you set up any automated back ups or anything else new on your Mac?
Is this a cloud space, ie Dropbox or Google drive that may be doing automatic versioning?
1. Check your library if you have the dataset in there already. If you do, erase it and see if you replicate the issue.
2. Try the following before your programs and retry.
3. Can you replicate it with another dataset, what happens with the following, or if you add the SLEEP pause step in between your data import and proc contents.
data survey.class; set sashelp.class; run; data _null_; sleep(10); run; proc contents data=survey.class; run;
4. Have you modified any of the settings - changing your work location, options etc that are in your autoexec?
05-23-2017 02:17 PM
That is odd. Are you sure the survey libref is not being changed between creating the dataset and running the proc contents? If you are in the Windows environment, you can look at the survey library in explorer right after creating the dataset and right before running the proc contents. You can also see the directory assigned to the library in the explorer window.
05-23-2017 04:33 PM
05-23-2017 04:40 PM
That is only the log of the proc contents. Where is the step creating the dataset?
05-23-2017 05:04 PM
I don't see anything unusual with your code.
Here are some troubleshooting ideas:
Will proc contents work if you resubmit the libname statment? Do you see the file in the directory?
if you just do a simple data step to create the dataset, does that work?
libname survey "/folders/myfolders/Cannabis";
a = 1;
proc contents data = survey.cscsp_2016 varnum;
05-23-2017 05:24 PM
You need to show it back to back, ie the log with the input and proc contents in one series. Otherwise we have no idea of what's been done in between. 99% of these issues are user errors, which is why we're being so picky.
You should fix your import first by the way - that's far from a clean log.
05-23-2017 07:03 PM - edited 05-23-2017 09:28 PM
The PROC CONTENTS runs successfully when I run it concurrently w/ the LIBNAME and PROC CONTENTS steps, but not when I run it AFTER running the LIBNAME and DATA steps (Syntax below).
If I run the entire SAS program successfully, I get the "ERROR: File SURVEY.CSCSP_2016.DATA does not exist." error in the subsequent SAS program using that data set.
05-23-2017 05:40 PM - edited 05-23-2017 05:41 PM
The two most likely causes for this disappearance are:
A) You run your code against two different SAS servers
--> make sure you execute against the same server
B) You run your code in two different sessions
--> make sure you run both steps in the same session OR add the libname statement from your import step also the code with your Proc Contents.
And as a first test:
Copy your Proc contents code into the same code window where you've got your import code and run everything together. If this still doesn't work then please post the code and log of this execution so we can see everything together.
05-23-2017 07:46 PM
<your import code>
Could you please clarify?
There's no way to know what you're referring to here. Your 'IMPORT CODE' is the data step that you use to read the CSV file. It's obviously incorrect since you have all the NOTES in your log. So you should fix this.
You're statement that if you run them back to back means everything is working as expected. You have something else going on.
You should talk to someone on site or someone familiar with your installation to see. It looks like you're working on SAS UE, but I know that isn't an issue because I constantly use permanent data sets. So without knowing exactly what you're doing ¯\_(ツ)_/¯
Explain what you're doing step by step and include your log. And fix that import first, trying to wade through that is difficult and makes it easy to miss errors/notes that you should deal with.
05-23-2017 09:38 PM
<it's obviously incorrect since you have all the NOTES in your log. So you should fix this.>
It's fixed and re-posted.
<Explain what you're doing step by step>
I have a SAS program w/ a LIBNAME statement, a DATA step and a PROC CONTENTS step in one window. When I run this entire program, it executes succesfully. The log is posted above. However, when I then try to use the resulting data set (SURVEY.CSCSP_2016.DATA) in any other SAS program, I get an error in the Log: ERROR: File SURVEY.CSCSP_2016.DATA does not exist. I get the same error in the PROC CONTENTS step when I run the steps in this program incrementally (i.e. LIBNAME + DATA step, then PROC CONTENTS).
The SAS dataset appears in the SURVEY library when the DATA step is executed, but then disappears when the subsequent SAS program is run (e.g. PROC CONTENTS). And, a new SAS data set is created in the folder on my HD with an incremental number assigned to the data set name (i.e. cscsp_2016 2.sas7bdat, cscsp_2016 3.sas7bdat, cscsp_2016 4.sas7bdat, etc.) for each time the DATA step is re-run.
This syntax ran w/o problem for 2 months. All of the sudden it is choking.
Need further help from the community? Please ask a new question.