Help using Base SAS procedures

Proc Export w/ repeating Variables

New Contributor
Posts: 2

Proc Export w/ repeating Variables

I'm running a report and exporting the data to a CSV file but wondered if there was a way to remove the repeating values in the first column.

The way the data file is set up is that the IDs are duplicated based on whether are multiple values in any of the columns so each observation is unique and I dont want to remove them. I guess this would be for mainly an asthetic value.


Output Example:


ID                      Col1     Col2     Col3     …

Loan A              X          A         B           …

Loan A              X          C         D          …

Loan A              X          E         F           …

Loan B              A         Y         C           …

Loan B              B         Y         D           …

Loan C             …         …         …         …

Loan D             …         …         …         …



Trusted Advisor
Posts: 1,837

Re: Proc Export w/ repeating Variables

It can be done using PROC REPORT :

   proc report data=have;

         columns ID COL1 COL2 COL3 ...;

         define ID / order ;

         define COL1;

         define COL2;

         define COL3;



New Contributor
Posts: 2

Re: Proc Export w/ repeating Variables



Can I output to a CSV using PROC REPORT then same way as PROC EXPORT?

Super User
Posts: 13,583

Re: Proc Export w/ repeating Variables

Exporting data will do that.

CSV is intended for data interchange in which case you would not really want the values to dispear from some records.

If you use a report procedure such as Proc Report or Tabulate that will allow things to group then you could write the results fo the procedure. Since it sounds like you may actually want a report and not a data interchange then use ODS RTF or PDF with an appropriate report procedure.

Super User
Super User
Posts: 9,599

Re: Proc Export w/ repeating Variables

CSV = Comma Separated Variable text file.  Is designed for data transfer.  It is not an Excel file!

Now decide what you want that output for, if it is to send data somewhere, then go ahead and export to CSV, and all the data will appear, ID on each line per the definition of a CSV.  If however you just want some review output in Excel, then use proc report and create a report in an Excel file - ods tagsets.excelxp or excel will do the trick and you have all the functionality therein.

Again, CSV is not the same as Excel

Ask a Question
Discussion stats
  • 4 replies
  • 1 like
  • 4 in conversation