BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
pchen002
Obsidian | Level 7

The following SAS program is submitted:


libname temp ‘SAS data library’;
data temp.sales;
merge temp.sales
work.receipt;
by names;
run;
The input data files are sorted by the NAMES variable:

 

Happen to see this question, so is it okay to have same name for SAS data set that is referenced for both read
and write operations??

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

You can do it, which does not mean you should. If you have an error, you need to recreate the dataset from its original source(s).

 

PS when you create dataset xxx, SAS writes to a file named xxx.sas7bdat.lck. Once the step has finished, that file is renamed to xxx.sas7bdat. If a file with that name already exists, it is deleted first.

If an error (that SAS detects!) happened, and xxx.sas7bdat already exists, no rename is done, the new file is deleted, and the original kept. But that does not protect you from a logical error that is not detected by SAS.

View solution in original post

2 REPLIES 2
FredrikE
Rhodochrosite | Level 12

Yes!

🙂

Kurt_Bremser
Super User

You can do it, which does not mean you should. If you have an error, you need to recreate the dataset from its original source(s).

 

PS when you create dataset xxx, SAS writes to a file named xxx.sas7bdat.lck. Once the step has finished, that file is renamed to xxx.sas7bdat. If a file with that name already exists, it is deleted first.

If an error (that SAS detects!) happened, and xxx.sas7bdat already exists, no rename is done, the new file is deleted, and the original kept. But that does not protect you from a logical error that is not detected by SAS.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 2 replies
  • 795 views
  • 1 like
  • 3 in conversation