BookmarkSubscribeRSS Feed
chennupriya
Quartz | Level 8

HI,

i have a code I should the records which has only those vendors names but I have 30 vendor names and I don't want to type all those vendor names so is there any way . keeping all those 30 vendor names in excel and can call it using macro . Any  idea ?? Pls help

4 REPLIES 4
PaigeMiller
Diamond | Level 26

Can you provide more details about what you want to do? What should the code do? What output should the code have?

--
Paige Miller
Steelers_In_DC
Barite | Level 11

You can import the excel file and write it out to a sas dataset that you can call on, you can write the 30 names into a proc format.  I'm sure there are other options but without more details it's hard to help.

Kurt_Bremser
Super User

Import the list of vendors into SAS.

Create a proper cntlin file for proc format that assigns the value 1 to all vendors, and attach a line for "other" that assigns 0,

Aplly that format in a data step and keep only the records where the formatted value is 1.

If you're not yet firm with all these procedures/steps, copy/paste the list into the EG code window and reformat it manually so that it can be used in an "in" condition.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi,

proc import datafile="xyz.xlsx" out=temp;

run;

proc sql;

     create table WANT as

     select      *

     from         HAVE

     where     VENDOR in (select distinct COL1 from TEMP);

quit;

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 4 replies
  • 872 views
  • 0 likes
  • 5 in conversation