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

I have a process that inserts data into a permanent table, after the insert, the permanent table has to be sorted. The should run about once a month.

I wrote a create table statement where the source and destination are the same permanent table and get the following error: "This CREATE TABLE statement recursively references the target table. A consequence of this is a possible data integrity problem."

 

I googled it and found there's an option to disable the warning, but I'm wondering if it's bad practice to leave it like this, and if so, how do I write the program so as to not risk data integirty.

 

Thanks in advance.

proc sql;
insert into perm_table
select * from source;

create table perm_table as
select * from perm_table
order by id;
quit;
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Is there something wrong with using Proc Append and then Proc Sort?

 

proc append base=perm_table data=source;

run;

 

proc sort data=perm_table;

   by id;

run;

View solution in original post

2 REPLIES 2
ballardw
Super User

Is there something wrong with using Proc Append and then Proc Sort?

 

proc append base=perm_table data=source;

run;

 

proc sort data=perm_table;

   by id;

run;

Datino
Obsidian | Level 7

No, I forget to use other procs sometimes because I'm more familiarized with sql.

 

Thank you.

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2184 views
  • 1 like
  • 2 in conversation