BookmarkSubscribeRSS Feed
jhh197
Pyrite | Level 9

Hi ,

Just wanted to check what extra step I need to add  to select 10 records from table1

 

PROC SQL;

   CONNECT TO odbc  as test

    (PATH=ksts  userid=ksdetail password=&hh);

            CREATE TABLE MyTable AS

            SELECT *

            FROM CONNECTION TO test (

                 SELECT

                       t1.ID

                      FROM Table1 t1

                   );

             DISCONNECT FROM test;

QUIT;

 

Can anyone help

 

Thanks

2 REPLIES 2
SASKiwi
PROC Star

Using your program this is the easiest way, not necessarily the most efficient:

 

PROC SQL;

   CONNECT TO odbc  as test

    (PATH=ksts  userid=ksdetail password=&hh);

            CREATE TABLE MyTable (obs= 10) AS

            SELECT *

            FROM CONNECTION TO test (

                 SELECT

                       t1.ID

                      FROM Table1 t1

                   );

             DISCONNECT FROM test;

QUIT;
Tom
Super User Tom
Super User

The only TABLE1 in that query is in a remote database.

So you need to know what syntax that database allows for limiting the number of observations returned by a query.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 391 views
  • 0 likes
  • 3 in conversation