what is prime numbers? how we can get plc write sas code?

Answers were Sorted based on User's Feedback



what is prime numbers? how we can get plc write sas code?..

Answer / bala

***how we can get plc write sas code? ;
data prime;
input numbers @@;
datalines;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
47 48 49 50 51 52 53 54 55 56 57 58
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
76 77 78 79 80
;
run;


data p1(drop= p numbers);
set prime;
P=numbers;
if mod(P,1)= 0 and mod(P,P) = 0 and mod(P,2) ^= 0
and mod(P,3) ^= 0 and mod(P,5)^=0 and mod(P,7)^=0 then
Prime_numbers=P;
if P=3 or P=2 or P=5 or P=7 then Prime_numbers=P;
if not missing(prime_numbers);
put prime_numbers;
run;

Is This Answer Correct ?    9 Yes 1 No

what is prime numbers? how we can get plc write sas code?..

Answer / sandeep

****** What is prime numbers?******
A) A prime number is a number that cannot be divided by a
number other than 1 and itself.

Is This Answer Correct ?    9 Yes 1 No

what is prime numbers? how we can get plc write sas code?..

Answer / santosh reddy

data prime (drop=j count);
do i=100 to 1 by -1;
count=0;
do j=i to 1 by -1;
if mod(i,j)=0 then count+1;
end;
if count=2 then output;
/* output;*/
end;
run;

Is This Answer Correct ?    6 Yes 1 No

what is prime numbers? how we can get plc write sas code?..

Answer / nandu

A small correction in the above one.

Data samp;
input number1 @@;
cards;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
;
run;
data samp2;
set samp;
number2=number1 ;
if mod(number1,1) eq 0 and mod(number1,number2) eq 0
and (mod(number1,2) ne 0 and mod(number1,3) ne 0 and mod(number1,5) ne 0 and mod(number1,7) ne 0 and mod(number1,9) ne 0) then output ;
run;

Is This Answer Correct ?    2 Yes 4 No

what is prime numbers? how we can get plc write sas code?..

Answer / nandu

Data samp;
input number1 @@;
cards;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
;
run;
data samp2;
set samp;
number2=number1 ;
if mod(number1,1) eq 0 and mod(number1,number2) eq 0 then
output ;
run;

Is This Answer Correct ?    4 Yes 9 No

Post New Answer

More SAS Interview Questions

Why do we use QUIT commmand for proc datasets and proc sql ???

3 Answers  


Name any two sas spawners? : sas-grid-administration

0 Answers  


data study; input Subj : $3. Group : $1. Dose : $4. Weight : $8. Subgroup; x= input(Weight,5.1); datalines; 001 A Low 220 2 002 A High 90 1 003 B Low 193.6 1 004 B High 165 2 005 A Low 123.4 1 ; Why does X get truncated? X shows up as 22 instead of 220,9 instead of 90 and 19.8 instead of 198? This problem doesnt happen with the values 193.6 and 123.4. This does not happen if x is read on the 5. informat instead of the 5.1 informat

2 Answers  


What is a post baseline?

1 Answers  


For what purpose(s) would use the RETURN statement?

1 Answers  






hi i am nipun can anybody tell me that if a clinical sas programmer write the code and after successfull execution where do they store it. how they submit tables to TL how work is assigned to programmers either both code, log, output to be submitted. can any one tell me the process

2 Answers   HSBC,


Which function is used to count the number of intervals between two sas dates?

0 Answers  


What is the differnce between SDTM 3.1.2 to 3.1.1 version

0 Answers   Wipro,


what is the difference between x=substr(name,1,2); and substr(name,1,2)='x';

3 Answers   HSBC,


explain the key concept of sas? : Sas-administrator

0 Answers  


I need to find the numeric field which contains blank in between..Ex:123 456...there is blank in between the 123 456..I need to know if there is any SAS function to find a field.. Please suggest...

5 Answers   TCS,


What do you code to create a macro? : sas-macro

0 Answers  


Categories