BookmarkSubscribeRSS Feed
sdang
Quartz | Level 8

I have these points (or floating points?) in column Buy In, see image below.  I want to create a user defined format to change floating points tp zero because it's easier to handle them in excel.

I got the steps from this community on how to do it but it's doesn't give me what I want.  Help please.

Capture.PNG

10 REPLIES 10
sdang
Quartz | Level 8


Forgot to add, these are the instructions I was given on this site:

  1. In EG, click Tasks->Data->Create Format to start the
    Create Format task (or you can just submit the code below, similar to what the
    task will generate)
  2. Give the format a name (ex. "MissingLabelFmt")
  3. Check Specify
    format width
    and give it a reasonable width (ex. 12)
  4. On the Define Formats page, click New
  5. Specify your desired label (ex. "Other" or
    "Missing")
  6. In the Range definition area, select Missing values in the
    Values dropdown
  7. Run the task

After
creating the user-defined format, apply it to your column...

  1. In the EG Query Builder (where you did the join), on the Select Data tab,
    double-click the MarketingZone variable
  2. Click the Change
    button next to the Format field
  3. Click the User Defined category and select the format you
    defined (ex. $MISSINGLABELFMT.)
  4. Click Ok, Ok, then Run
ballardw
Super User

What do you mean by "change floating point to 0"? do you mean to no display the decimal part or to remove any decimal part? A format like F4.0 would not display any decimal. If you still want $ to appear then try a format like dollar6.0.

To change the value round with the Round function.

sdang
Quartz | Level 8

I would like to change any rows with decimal point to zero.  I would I do that . Thanks

ballardw
Super User

I'm not sure I understand. If the current value is 100.00 you want to display 0 or 100?

sdang
Quartz | Level 8

I want to the missing values which SAS display as a point.  I want those missing values to display zero. Sorry for the confusion.

ballardw
Super User

I don't use EG. This code generates a format that does what I think you are asking for:

proc format library=work;

value mydollar

. = '$0'   /* if you don't want $ to appear then just '0'*/

other=[dollar8.2]   /* what ever the current format you are using for that column goes inside [ ]*/

;

run;

Assign the MYDOLLAR format after it is created to the column(s) needed.

If you have a mixture of desired output like $ format and simple format like F4.2 you would need a separate format for each.

sdang
Quartz | Level 8

I followed your steps and the Program runs but I couldn't find the format in the assigned work.query dataset.

sdang
Quartz | Level 8

These are the codes I inputted in Program

Capture.PNG

ballardw
Super User

Just the library. I would expect to get an error work.query...

The format would be the WORK library. I would expect that just going to assign format method you should be able to find MYDOLLAR in the list of available formats, or type in the name of the library.

sdang
Quartz | Level 8

It was helpful.  Thank you.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 10 replies
  • 1305 views
  • 3 likes
  • 2 in conversation