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
- :
- Changing DT values using JSL

Topic Options

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Jul 8, 2011 6:12 AM
(2602 views)

Hi, I'm fairly new to SAS software in general, and even more unfamiliar with JSL. I'm making very simple automation scripts and am running into issues.

I would like to (In a data table of 600,000+ entries)

1) Select certain rows based on specific criteria

ex: dt<< Select Where(age>15)

2) Manipulate a specific column based on that row selection

ex: For those rows with age>15 change the column "Eleigible" from "No" to "Yes"

I do not know how to code this second part, I'd imagine it's pretty simple. I've read the JMP basic scripting tutorial, but I can't seem to figure out how to execute this simple operation.

Any help would be appreciated.

-Anthony

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Jul 8, 2011 7:22 AM
(4831 views)

Solution

It's not too hard. Here's an example using Big Class:

dt = open**(**"$sample_data\Big Class.jmp"**)**;

one_set_rows = dt << get rows where**(**:sex == "F"**)**;

column**(**dt, "name"**)[**one_set_rows**]** = "Female";

Basically you use GET ROWS WHERE to get a matrix of row numbers that match a certain condition. The last line allows you to put one value in all rows found that match the condition.

2 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Jul 8, 2011 7:22 AM
(4832 views)

It's not too hard. Here's an example using Big Class:

dt = open**(**"$sample_data\Big Class.jmp"**)**;

one_set_rows = dt << get rows where**(**:sex == "F"**)**;

column**(**dt, "name"**)[**one_set_rows**]** = "Female";

Basically you use GET ROWS WHERE to get a matrix of row numbers that match a certain condition. The last line allows you to put one value in all rows found that match the condition.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Jul 8, 2011 8:36 AM
(2517 views)

Or - if you have to make a new column anyway:

dt<<new column**(**"Eligible",character,formula**(**If**(**:Age < **15**, "no", :Age >= **15**, "yes"**)))**;

BR, Marianne