Help using Base SAS procedures

sas data set can not open!!

Reply
Occasional Contributor
Posts: 5

sas data set can not open!!

Hi there,

I met a very weird situation and found a newly created SAS data set cannot open.

It happened when I created a data set B based on A after some modification. Then I

turned off the SAS session but latter I found B cannot be opened by SAS 9.2. B is

permanent and I know where it is. And it was so strange that, on the other hand, I was

able to view it using universal viewer. Does anyone know what cause this and how to

solve it?

Thanks everyone~

^-^
Trusted Advisor
Posts: 2,113

Re: sas data set can not open!!

call tech support.
Contributor
Posts: 57

Re: sas data set can not open!!

Hi,

Does any of the variable in the dataset is linked to any user defined format? If so run the PROC FORMAT which defines the formats and then open it. It will open.

Regardz,
Sandhya.
Occasional Contributor
Posts: 5

Re: sas data set can not open!!

Thank you a lot!! Sandhya, yeah, the problem is I used proc format to define some formats when I revised the data set. As you suggest, now it opens once i run the proc format again!!

Another question follows: it seems like the proc format could bring potential problem if I want to share the data with my colleagues especially when they don't know how I defined the user-defined format. But I like proc format personally because it does help a lot for analysis or creating report. So any suggestions about when this proc format should be used?

Again, thanks for solving my problem Smiley Happy
Contributor
Posts: 57

Re: sas data set can not open!!

Hi,

Instead of attaching the format to the dataset, you can create a variable with the format.

Eg:

data one;
input id flag;
cards
0001 1
0002 0
0003 1
0004 1
0005 0
;
run;

proc format;
value flagvar 0 = 'Absent'
1 = 'Present';
run;

Instead of doing the following

data two;
set one;
format flag flagvar.;
run;

Why not do this

data two;
set one;
flag1 = put(flag, flagvar.);
run;

This way the values are created with the formatted values.

There are more advanced way of dealing with it, like attaching some format catalogs and so on. But, I prefer this. Less hassle.

Regardz,
Sandhya.
Occasional Contributor
Posts: 5

Re: sas data set can not open!!

Hi, Sandhya, I tried your code and I think it is a more efficient way of dealing with format as well as avoiding potential format error.

Thank you so much!!
Occasional Contributor
Posts: 14

Re: sas data set can not open!!/format

Hi,

About the storage and retrieving user-defined format you could read from:
http://support.sas.com/kb/37/332.html

It will be a good practice to create some documentation about the user-defined format and then you could share with all those using that format.

Warm regards,
Vasile
Valued Guide
Posts: 2,175

Re: sas data set can not open!!/format

Just as the universal viewer can read the data, so can SAS, if you prepare with
option NOfmterr ;
(no format errors)
before using the data set

It just presents the internal value in the default format for numbers or strings.
Occasional Contributor
Posts: 5

Re: sas data set can not open!!/format

Wow, I think this is the easiest way~~

Thank you~
Occasional Contributor
Posts: 5

Re: sas data set can not open!!/format

Hi Vasile01, I read this note and It did helped me to understand the storage and user-defined format. Perhaps I could try to build some format catalogs to store my defined format somewhere separately from my coding.

Thanks a lot for the useful information!!
Contributor
Posts: 31

Re: sas data set can not open!!

Hi ... I am having a related problem.

 

I recently switched from base SAS to EG, so still very new to the way if works.

 

I am busy rebuilding my scripts in EG, so I have a process flow of various programs and tables that feed into one another. After a timely excersice where macro variables didn't transfer (I didn't know you could/had to define them as global), I got a part of my script working, but now I have a problem where the logs states my table 'work.loans' were created with 63 089 rows and 8 columns, and the data table icon appears in the process flow with the name 'loans' . However, the subsequent scripts say table 'loans' does not exist, and when I double click on the 'loans' table icon, EG says "WORK.LOANS does not exist. You will need to refresh the task". But the table does not show on the left under the work library.

 

I am doing something really idiotic? I've never had this type of problem in base SAS.

 

 

I'd appreciate some advice....I'll continue googling the problem.

 

 

GD

Contributor
Posts: 31

Re: sas data set can not open!!

Ok...figured out that it has to do with the 'Allow parallel execution on the same server'. If you swtich that off, the problem goes away. Possible to do with the way EG handles the different sessions. Pity you can't have the parallel execution like on SQL SSRS.
Ask a Question
Discussion stats
  • 11 replies
  • 5821 views
  • 0 likes
  • 6 in conversation