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

What is the use of function Proc summary?

0 Answers  


What do you know about sas data set?

0 Answers  


what is the usage for assigning error=1 in a dataset ?

2 Answers   Satyam,


What statement do you code to tell SAS that it is to write to an external file? What statement do you code to write the record to the file?

2 Answers   Accenture,


i have multiple .csv files in a unix directory. every file is having variable names as header.even for empty file also. suppose take 3 files a.csv b.csv c.csv a.csv contains data as name;age,salary; raja;34;4000; ravi;33;5000; kumar;25;3000; b.csv contains data as name;age,salary; ajay;40;4500; and c.csv contains name;age,salary; (only headers) Now i want to import and append all these files in to a single dataset. i tried infile statement with *.csv to import all at a time. but i m not getting correct data. please help me . its urgent. thank you in advance

2 Answers   Tech Mahindra,






what is Global Symbol table and Local symbol table?

4 Answers   CitiGroup,


IS SAS COMPILER OR INTERPRETER? EXPLAIN?

3 Answers   Aon Hewitt, HSBC, SCL, TCS,


which stats created by proc means that are not created by proc summary or vice versa?

2 Answers   GSK,


What is factor analysis?

0 Answers  


hi all, I need the SAS DI DUMP(A00 260) for attending the certification. if any one have, pls provide it.Please Email to vrpotluri@hotmail.com. Thanks - Ramana

0 Answers   SAS,


what is ae onset date n what is RDS

0 Answers   Accenture,


what are some good sas programming practices for processing very large data sets? : Sas programming

0 Answers  


Categories