BookmarkSubscribeRSS Feed
HeatherNewton
Quartz | Level 8
I have data output in %, how do i convert it such that i can load into db2 without losing any meaning
5 REPLIES 5
Kurt_Bremser
Super User

In SAS, percentages are numeric ratios with a PERCENT format attached. Check with your DB designers how they want such values.

Do you write the data to DB/2 with SAS/ACCESS, or do you use text files for the data transfer?

HeatherNewton
Quartz | Level 8
I use proc export to csv
SASKiwi
Opal | Level 21

If you attach the PERCENT format to a SAS variable, then percentages under 100 must be defined as a decimal less than 1. Your CSV will then contain contain values like below with a % suffix:

28         data _null_;
29           percentage = 0.1234;
30           format percentage percent8.2;
31           put percentage=;
32         run;

percentage=12.34%
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

As @Kurt_Bremser says, check with your DB2 admin to confirm the required data format.

Kurt_Bremser
Super User

@HeatherNewton wrote:
I use proc export to csv

Then you need to ask your DB people how they want the data presented in the csv file. Most probably, they don't want the percent sign, but the percent value (not the ratio), so you would need to multiply by 100 and use a standard numeric format.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 166 views
  • 0 likes
  • 3 in conversation