BookmarkSubscribeRSS Feed
Markanti
Calcite | Level 5
  1. Create a new data set called “half” from “main”.  Reduce this dataset by ½ using a random number generator for the uniform distribution (ranuni) with the seed of 100.

Unfinished Code

*Lab 8 – Problem 5;

data

run;

I run the code like this ? is it correct?

*Lab 8 – Problem 5;

data lab.half;
set lab.main;
random = ranuni(0);
if ranuni(100) < 0.5 then output;
run;

proc print data=lab.half;
run;

1 REPLY 1
Kurt_Bremser
Super User

See Maxim 4. Run the code in your environment and study the results (number of 0bservations, content of variables).

The creation of a new variable was not asked.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 798 views
  • 0 likes
  • 2 in conversation