Desktop productivity for business analysts and programmers

How to decrease code

Reply
Frequent Contributor
Posts: 123

How to decrease code

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

Trusted Advisor
Posts: 1,785

Re: How to decrease code

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

Valued Guide
Posts: 858

Re: How to decrease code

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.

Super User
Posts: 7,421

Re: How to decrease code

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Super User
Posts: 7,710

Re: How to decrease code

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;

Ask a Question
Discussion stats
  • 4 replies
  • 428 views
  • 0 likes
  • 5 in conversation