turn on suggestions

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

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- General Programming
- /
- a few simple questions (data manipulations)

Topic Options

- 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
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-29-2015 09:03 PM

I have a few (simple) questions but my instructor was not able to respond. I wonder if I can find a help here:

1) If I would like to assign a value in to a column X and a row Y in a dataset , how could I do that? For example, in R we can write: dataset[Y,X]=5.

2) Is there a function that can show which observation number for a given variable has a missing value? For example, in R: which (is.na(var))

3) Is there a function that can show which observation number for a given variable equals a certain number? For example, in R: which (var==5)

4) Is there a function that can assign a variable that equals variable names? For example, in R: new_var=names(dataset).

Thanks,

Yulia

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

Posted in reply to jula

03-30-2015 08:03 AM

1) If I would like to assign a value in to a column X and a row Y in a dataset , how could I do that? For example, in R we can write: dataset[Y,X]=5.

if _n_ = X then Y=5;

2) Is there a function that can show which observation number for a given variable has a missing value? For example, in R: which (is.na(var))

whichn(.) or whichc(.)

3) Is there a function that can show which observation number for a given variable equals a certain number? For example, in R: which (var==5)

if var=5 then put _n_ ;

4) Is there a function that can assign a variable that equals variable names? For example, in R: new_var=names(dataset).

vname(.)

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

Posted in reply to Ksharp

03-30-2015 12:22 PM

Great! Thanks a lot! Yulia