BookmarkSubscribeRSS Feed
alperebb
Calcite | Level 5

Hello,

We ran a query code in the SAS Develop section and it brought us the values we wanted in the output data section. But we couldn't figure out how to convert the output data table into a new table. I will share two screenshots. In the first one we have our query code. In the other one, I have the output data that I will share by hiding the information. Please help me to convert this output data into a table.

 

Here is the code.

PROC SQL;
    CREATE TABLE WORK.QUERY_FOR_PO_PR_SSH1 AS
        SELECT
            t1.Created_By,
            t1.No_,
            t1.'Posting Description'n,
            t1.'Vendor Invoice No_'n,
            t1.Invoice_,
            t1.'Cancel Reason'n,
            t1.'Cancel Reason Text'n,
            t1.'Modifed By'n,
            t1.'Deleted By'n,
            t1.'Purchase_ Order_Date'n,
            t1.Creation_Date,
            t1.Original_Invoice_Date,
            t1.'Purchase_ Order_Date'n AS 'Purchase_ Order_Date1'n
        FROM
            TEST.PO_PR_SSH1 t1
        WHERE
            t1.'Purchase_ Order_Date_'n < t1.'Original_Invoice_Date_'n
    ;
QUIT;

MicrosoftTeams-image.pngMicrosoftTeams-image (1).png

 

1 REPLY 1
Patrick
Opal | Level 21

Below from the generated code is already creating a table in SAS WORK.

Patrick_0-1679381204666.png

Tables under SAS WORK get physically saved on disk but only exist as long as your SAS session exists (=SAS deletes the physical folder location for WORK and all its content on termination of your SAS session).

 

If you want to store the table permanently then just point it to a different libref (other than WORK) when using the wizard.

The libref must pre-exist - either available via a pre-assigned library or then via a libname statement executed before you use the wizard.

 

You could also just copy/past the generated code into a code node and then modify manually. Somethin like:

libname perm '/mydata/demo/myfolder';
PROC SQL;
    CREATE TABLE perm.mytable AS
        SELECT
        ......
      ;
quit;

 

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

From SAS Users blog
Want more? Visit our blog for more articles like these.
5 Steps to Your First Analytics Project Using SAS

For SAS newbies, this video is a great way to get started. James Harroun walks through the process using SAS Studio for SAS OnDemand for Academics, but the same steps apply to any analytics project.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 157 views
  • 0 likes
  • 2 in conversation