Contributor
Posts: 53

Pvalue6.4 to character conversion

Hi,

I have a variable called var4N, which is  numeric type and has format pvalue6.4.

IN my case, var4N has the value <.0001.

I need to convert this to characer variaalbe.

If I try

var4=put(var4N, f6.4);

I am getting 0.0001, instead of <.0001.

Super User
Posts: 10,239

Re: Pvalue6.4 to character conversion

Well, if your numeric value is smaller than 0.0001, then you obviously need to give your format more digits to the right of the decimal point.

Try 10.8, for example:

```24         data _null_;
25         x = 0.0000954;
26         x1 = put(x,10.8);
27         put x1=;
28         run;

x1=0.00009540
```
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Contributor
Posts: 53

Re: Pvalue6.4 to character conversion

I am looking specifically for value <.0001.

It should get converted to <.001 rather than showing .0001

Thanks

Archana

Super User
Posts: 23,721

Re: Pvalue6.4 to character conversion

I see. Did you try the PValue format?

Super User
Posts: 10,239

Re: Pvalue6.4 to character conversion

The pvalue format does work, see:

```24         data _null_;
25         x1 = .00001;
26         x2 = put(x1,pvalue6.4);
27         put x2=;
28         run;

x2=<.0001
```
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Super User
Posts: 23,721

Re: Pvalue6.4 to character conversion

Use pvalue6.4 in your PUT statement if you want to character variable to match what appears in the numeric variable.

Contributor
Posts: 73

Re: Pvalue6.4 to character conversion

First try to Drop this symbol (<), then try to show this value 0.000001 in format.

Later you change to character variable as a Normal process. (using put).

Discussion stats
• 6 replies
• 601 views
• 0 likes
• 4 in conversation