BookmarkSubscribeRSS Feed
Calcite | Level 5

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             …         …         …         …



Garnet | Level 18

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;



Calcite | Level 5



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

Super User

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.

Diamond | Level 26 RW9
Diamond | Level 26

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



Secure your spot at the must-attend AI and analytics event of 2024: SAS Innovate 2024! Get ready for a jam-packed agenda featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events.


Register by March 1 to snag the Early Bird rate of just $695! Don't miss out on this exclusive offer. 


Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1 like
  • 4 in conversation