- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello team,
if I have data as
data mystestdata; set fromthissorted by memberID; if first.memberID then output; Run;
if first.memberID means from the grouped data, only read the first memberID from the group?
Please advise me.
Respectfully,
blueblue
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@GN0001 wrote:
Hello team,
if I have data as
data mystestdata; set fromthissorted by memberID; if first.memberID then output; Run;if first.memberID means from the grouped data, only read the first memberID?
Please advise me.
Respectfully,
blueblue
After you correct the code so that the Set statement has a terminating semicolon ...
Not read, when encountered. This will "read" all the records in the data set(s) on the Set statement.
If the data is sorted by the By variable then only the records that are the first for each value of the by variable will be written to the output data set. If not sorted an error will be thrown.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello ballardw,
When you say: " that are the first for each value of the by variable will be written to the output data set"
Do you mean the first for each group?
Please let me know.
Thanks,
blueblue
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@GN0001 wrote:
Hello ballardw,
When you say: " that are the first for each value of the by variable will be written to the output data set"
Do you mean the first for each group?
Please let me know.
Thanks,
blueblue
Each distinct value of a BY variable constitutes a group.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You would do well to teach yourself. Besides reading the documentation, try running a test program. Here is an example:
data mystestdata;
set fromthissorted;
by memberID;
first = first.memberID;
last = last.memberID;
Run;
proc print;
var memberID first last;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
READ
THE
DOCUMENTATION
the link to which (this particular documentation!) I already gave you.
And apply Maxim 4. Try It.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
How do you know I have not read the documentation? I have read it a several time and I watched video tutorials. Please kindly bear with me. If we could understand each topic with reading, then what is the point of going to school?
Respecctfully,
Blueblue