Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Discussions
- :
- digits to appear as double digits

Topic Options

- Start Article
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Feb 17, 2017 2:38 AM
(2262 views)

Hi

The JSL script below is outputting a week number from a data in JSL. however it outputs the lower weeks as 1-9 in single digits however, I need these to appear in double digits ie 01 instead of 1, 02 instead of 2..etc.

I am hoping someone knows a way to do this, any ideas would be great.

**JSL script**

ST << New Column( "ww",

Numeric,

"Nominal",

Format( "Best", 12 ),

Formula( Week Of Year( :time ) )

);

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

If you are using JMP 13, in your script, set the format to:

```
Format(
"Custom",
Formula( Substr( "00", 1, 2 - Length( Char( value ) ) ) || Char( value ) ),
12
)
```

Jim

3 REPLIES 3

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

If you are using JMP 13, in your script, set the format to:

```
Format(
"Custom",
Formula( Substr( "00", 1, 2 - Length( Char( value ) ) ) || Char( value ) ),
12
)
```

Jim

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: digits to appear as double digits

Thanks alot Jim.

Spent ages trying to find something that could do that in the column info.

Not exactly sure how substring command is doing that but it works.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: digits to appear as double digits

To learn about the Substr function and as a matter of fact, any of the functions, go to the Scripting Index. For info on the Substring(Substr) function:

Help==>Scripting Index==>Functions==>Character==>Substr

Jim