- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have a database (.txt) made up of percentage:
50
40
20
10
41
But they must not be in this form
Which format or informat would allow to have this in sas table :
0.5%
0,4%
0,2%
0.1%
0,41%
Thanks for your help
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Depending upon what you actually want, here is an example of the percent format and informat on your example data:
data have; informat percent1 percent3.2; informat percent2 percent3.3; informat percent3 percent3.4; format percent1-percent3 percent6.2; input @1 percent1 @1 percent2 @1 percent3; x1=10*percent1; x2=10*percent2; x3=10*percent3; cards; 50 40 20 10 41 ;
Art, CEO, AnalystFinder.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you print these numbers using the PERCENT. format that is what you will get. Please be aware that it is not how you store the numbers in the table that determine how they are printed. That is what is controlled by the format definition. So SAS separates the data and the presention. As this is an important concept I advise you to read up on formats and informats.
Hope this helps,
-- Jan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Depending upon what you actually want, here is an example of the percent format and informat on your example data:
data have; informat percent1 percent3.2; informat percent2 percent3.3; informat percent3 percent3.4; format percent1-percent3 percent6.2; input @1 percent1 @1 percent2 @1 percent3; x1=10*percent1; x2=10*percent2; x3=10*percent3; cards; 50 40 20 10 41 ;
Art, CEO, AnalystFinder.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Are you sure this is what you want? The math is off here. Even if the number 50 refers to 50 percent, you can represent that as either 50% or 0.5. But 0.5% means something different.