BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Jahanzaib
Quartz | Level 8

I have data which contain 9 countries, Year from 2006-2010, Fam is a variable which has value 0 for non fam and  1 for fam

I want to calculate No of Observations in the following format

Country         Fam      Non fam        total

HKG

KOR

and here is my data.

 

data work.new;
infile datalines dsd truncover;
input Global_Company_Key:32. SICC:32. CoName:$255. company:$255. fam:32. Country:$255. year:32.;
datalines;
200687,7370,BEIJING DEVELOPMENT (HK) LTD,BEIJING DEVELOPMENT,0,HKG,2009,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
200687,7370,BEIJING DEVELOPMENT (HK) LTD,BEIJING DEVELOPMENT,0,HKG,2010,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
200687,7370,BEIJING DEVELOPMENT (HK) LTD,BEIJING DEVELOPMENT,0,HKG,2007,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
200687,7370,BEIJING DEVELOPMENT (HK) LTD,BEIJING DEVELOPMENT,0,HKG,2008,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
200687,7370,BEIJING DEVELOPMENT (HK) LTD,BEIJING DEVELOPMENT,0,HKG,2006,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
202779,4922,BEIJING ENTERPRISES HOLDINGS,BEIJING ENTERPRISES,0,HKG,2009,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
202779,4922,BEIJING ENTERPRISES HOLDINGS,BEIJING ENTERPRISES,0,HKG,2010,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
202779,4922,BEIJING ENTERPRISES HOLDINGS,BEIJING ENTERPRISES,0,HKG,2007,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
202779,4922,BEIJING ENTERPRISES HOLDINGS,BEIJING ENTERPRISES,0,HKG,2008,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
202779,4922,BEIJING ENTERPRISES HOLDINGS,BEIJING ENTERPRISES,0,HKG,2006,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
282713,2070,CHINA AGRI INDUS HOLDINGS,CHINA AGRI PRODUCTS,0,HKG,2009,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
282713,2070,CHINA AGRI INDUS HOLDINGS,CHINA AGRI PRODUCTS,0,HKG,2010,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
282713,2070,CHINA AGRI INDUS HOLDINGS,CHINA AGRI PRODUCTS,0,HKG,2007,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
282713,2070,CHINA AGRI INDUS HOLDINGS,CHINA AGRI PRODUCTS,0,HKG,2008,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
282713,2070,CHINA AGRI INDUS HOLDINGS,CHINA AGRI PRODUCTS,0,HKG,2006,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
16538,4512,CATHAY PACIFIC AIRWAYS LTD,CHINA METAL INTN'L,0,HKG,2009,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
16538,4512,CATHAY PACIFIC AIRWAYS LTD,CHINA METAL INTN'L,0,HKG,2010,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
16538,4512,CATHAY PACIFIC AIRWAYS LTD,CHINA METAL INTN'L,0,HKG,2007,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
16538,4512,CATHAY PACIFIC AIRWAYS LTD,CHINA METAL INTN'L,0,HKG,2008,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
220407,3600,CHINA AEROSPACE INTL HLDGS,CHINA METAL INTN'L,0,HKG,2006,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
220407,3600,CHINA AEROSPACE INTL HLDGS,CHINA OVERSEAS LAND,0,HKG,2009,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
220407,3600,CHINA AEROSPACE INTL HLDGS,CHINA OVERSEAS LAND,0,HKG,2010,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
220407,3600,CHINA AEROSPACE INTL HLDGS,CHINA OVERSEAS LAND,0,HKG,2007,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
220407,3600,CHINA AEROSPACE INTL HLDGS,CHINA OVERSEAS LAND,0,HKG,2008,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
201218,4991,CHINA EVERBRIGHT INTL LTD,CHINA OVERSEAS LAND,0,HKG,2006,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
201218,4991,CHINA EVERBRIGHT INTL LTD,CHINA OVERSEAS PROP,0,HKG,2009,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
201218,4991,CHINA EVERBRIGHT INTL LTD,CHINA OVERSEAS PROP,0,HKG,2010,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
201218,4991,CHINA EVERBRIGHT INTL LTD,CHINA OVERSEAS PROP,0,HKG,2007,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
65662,4812,CHINA MOBILE LTD,CHINA OVERSEAS PROP,0,HKG,2008,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
65662,4812,CHINA MOBILE LTD,CHINA OVERSEAS PROP,0,HKG,2006,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
259199,4991,CHINA RES PWR HLDG,CHINA RESOURCES LAND,0,HKG,2009,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
259199,4991,CHINA RES PWR HLDG,CHINA RESOURCES LAND,0,HKG,2010,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
259199,4991,CHINA RES PWR HLDG,CHINA RESOURCES LAND,0,HKG,2007,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
259199,4991,CHINA RES PWR HLDG,CHINA RESOURCES LAND,0,HKG,2008,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
259199,4991,CHINA RES PWR HLDG,CHINA RESOURCES LAND,0,HKG,2006,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
65662,4812,CHINA MOBILE LTD,CHINA TAIPING INSU,0,HKG,2009,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
162077,4813,CHINA NETCOM GROUP CORP,CHINA TAIPING INSU,0,HKG,2010,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
162077,4813,CHINA NETCOM GROUP CORP,CHINA TAIPING INSU,0,HKG,2007,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
102106,4991,CHINA POWER INTERNATIONAL,CHINA TAIPING INSU,0,HKG,2008,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
102106,4991,CHINA POWER INTERNATIONAL,CHINA TAIPING INSU,0,HKG,2006,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,CITIC RESOURCES,0,HKG,2009,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,CITIC RESOURCES,0,HKG,2010,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,CITIC RESOURCES,0,HKG,2007,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,CITIC RESOURCES,0,HKG,2008,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,CITIC RESOURCES,0,HKG,2006,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
142540,1311,CNOOC LTD,CNOOC LTD,0,HKG,2009,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
142540,1311,CNOOC LTD,CNOOC LTD,0,HKG,2010,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
142540,1311,CNOOC LTD,CNOOC LTD,0,HKG,2007,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
142540,1311,CNOOC LTD,CNOOC LTD,0,HKG,2008,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
142540,1311,CNOOC LTD,CNOOC LTD,0,HKG,2006,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
;;;;

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

http://www.ats.ucla.edu/stat/sas/modules/descript.htm

 

Thats is why I included links to video and code tutorials. 

 

You've been asking questions but not seeming to progress with your SAS skills. Is your intention to learn or simply have someone provide you a solution via code? 

View solution in original post

6 REPLIES 6
Jahanzaib
Quartz | Level 8
dont know proc freq
Reeza
Super User

http://www.ats.ucla.edu/stat/sas/modules/descript.htm

 

Thats is why I included links to video and code tutorials. 

 

You've been asking questions but not seeming to progress with your SAS skills. Is your intention to learn or simply have someone provide you a solution via code? 

Jahanzaib
Quartz | Level 8
I am learning. Its coding is complex. sometime i even spend days to learn simple thing but couldnt.
Reeza
Super User

There's the free SAS e course if you're interested. Takes 3 days full time but you can complete it at your leisure. 

 

http://support.sas.com/training/tutorial/

 

 

ballardw
Super User

The data you posted looks very much like it was a CSV created from Excel. Knowing enough to convert to CSV is a very good thing.

But I caution you to be very careful as Excel can have issues with exporting data depending on how it was entered or created. Values, such as product identifiers sometimes have aritmetic applied if the value has a - in it and Dates can be very problematic as to output format.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 1131 views
  • 1 like
  • 3 in conversation