- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Jag
- Tags:
- For Example
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Block Name= Barsathi
No. of auditors Required = 7
No. of Villages = 6
No. of IDs required = 42.
So the IDs will be Generate like
Barasathi1_1
Barasathi1_2
Barasathi1_3
Barasathi1_4
Barasathi1_5
Barasathi1_6
Barasathi2_1
Barasathi2_2
Barasathi2_3
Barasathi2_4
Barasathi2_5
Barasathi2_6
.
.
.
.
.
.
.
.
.
Barasathi7_1
Barasathi7_2
Barasathi7_3
Barasathi7_4
Barasathi7_5
Barasathi7_6
So total IDs genertaed 42
Where is the problem Sir.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Sounds like the following would do what you want/need:
data want (drop=_:);
informat Block_Name $15.;
infile cards dlm='09'x;
input Block_Name No_of_auditors_required No_of_Villages No_of_IDs_required;
do _i=1 to No_of_auditors_required;
do _j=1 to No_of_Villages;
id=catt(Block_Name,_i,'_',_j);
output;
end;
end;
cards;
Badlapur 6 3 18
Barsathi 7 6 42
Bhitargaon 15 30 450
Bilhaur 26 63 1638
Chaubepur 20 45 900
Dharampur 27 66 1782
Dobhi 10 15 150
Ghatampur 15 30 450
Kakwan 17 36 612
Kalyanpur 20 45 900
Karanjakala 80 225 18000
KHUTHAN 8 9 72
Mahrajganj 34 87 2958
Mariahu 18 39 702
Rampur 7 6 42
Shahganj 66 183 12078
Shivrajpur 20 45 900
Sikrara 19 42 798
Sirkoni 30 75 2250
SUITHAKALA 12 21 252
;
HTH,
Art, CEO, AnalystFinder.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It's not working .
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What you want to do must be quite simple to achieve but as @Jagadishkatam points out your narrative of the problem doesn't match with the data you've provided. You need to clarify.
If the solution @art297 provided doesn't fit your requirements then just writing "it's not working" is insufficient. You need to explain what's not working as this will help us to understand what you're actually after.
Again: Your problem won't be hard to solve. It's all about you explaining us clearly what you have and what you need in order to enable us to provide a working solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Apologies,
I am uploading the solution in R programming can you convert it in SAS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I personally don't have R skills but there are quite a few very capable and experienced members in this forum so I'm sure posting existing R code logic will help to illustrate what you're after.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Here is the solution but in R programming. So can you please change it to SAS programming.
Block <- c("Badlapur","Barsathi","Bhitargaon","Bilhaur","Chaubepur","Dharampur",
"Dobhi","Ghatampur","Kakwan","Kalyanpur","Karanjakala","KHUTHAN",
"Mahrajganj","Mariahu","Rampur","Shahganj","Shivrajpur","Sikrara",
"Sirkoni","SUITHAKALA")
NoA <- c(6,7,15,26,20,27,10,15,17,20,80,8,34,18,7,66,20,19,30,12)
NoV <- c(3,6,30,63,45,66,15,30,36,45,225,9,87,39,6,183,45,42,75,21)
for(m in 1:20){
a <- NoA[m]
b <- NoV[m]
for(j in 1:a){
for(i in 1:b){
print(paste0(Block[m],j,"_",i))
}
}
}
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The code I suggested does the same thing as your R code. You never mentioned what form of output you wanted. If you want the same kind of output that you get from your R code, you simply have to add one more proc step, namely:
proc print data=want noobs;
var id;
run;
Art, CEO, AnalystFinder.com