BookmarkSubscribeRSS Feed
tqphan
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             …         …         …         …

 

 

4 REPLIES 4
Shmuel
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;

         ...

   run;

tqphan
Calcite | Level 5

Shmuel,

 

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

ballardw
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.

RW9
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

SAS Innovate 2025: Register Today!

 

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1456 views
  • 1 like
  • 4 in conversation