Help using Base SAS procedures

Command for one column

Reply
Contributor
Posts: 60

Command for one column

Hi

I have the following database (see below). If I wanted to create a new spreadsheet containing only the CUSIP values what is the command to do this on SAS?

DATEHSICMGCOMNAMCUSIPDCLRDT
1985123168391610
1986013139OPTIMUM MANUFACTURING INC68391610
1986022839OPTIMUM MANUFACTURING INC68391610
1986033139OPTIMUM MANUFACTURING INC68391610
1986043039OPTIMUM MANUFACTURING INC68391610
1986053039OPTIMUM MANUFACTURING INC68391610
1986063039OPTIMUM MANUFACTURING INC68391610
1986073139OPTIMUM MANUFACTURING INC68391610
1986082939OPTIMUM MANUFACTURING INC68391610
1986093039OPTIMUM MANUFACTURING INC68391610
1986103139OPTIMUM MANUFACTURING INC68391610
1986112839OPTIMUM MANUFACTURING INC68391610
1986123139OPTIMUM MANUFACTURING INC68391610
1987013039OPTIMUM MANUFACTURING INC68391610
1987022739OPTIMUM MANUFACTURING INC68391610
1987033139OPTIMUM MANUFACTURING INC68391610
1987043039OPTIMUM MANUFACTURING INC68391610
1987052939OPTIMUM MANUFACTURING INC68391610
1987063039OPTIMUM MANUFACTURING INC68391610
1985123136720410
1986013149GREAT FALLS GAS CO36720410
1986022849GREAT FALLS GAS CO36720410
1986033149GREAT FALLS GAS CO3672041019860207
1986043049GREAT FALLS GAS CO36720410
Super Contributor
Posts: 1,636

Re: Command for one column

data want /* the dataset name you create */

set have (keep=CUSIP);

run;

PROC EXPORT DATA= want

            OUTFILE= "C:\temp\forum\want.xls"

            DBMS=EXCEL REPLACE;

     SHEET="list";

RUN;

/*change the red part */

Respected Advisor
Posts: 3,124

Re: Command for one column

Or :

You can apply that datastep option directly within proc export:

PROC EXPORT DATA= want(keep=CUSIP)

  OUTFILE= "C:\temp\forum\want.xls"

  DBMS=EXCEL REPLACE;

  SHEET="list";

RUN;

Haikuo

Ask a Question
Discussion stats
  • 2 replies
  • 169 views
  • 0 likes
  • 3 in conversation