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

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