I want to make following table. excel file is attached with this . fam is 0 for non-family firms while fam is 0 for family firms.
Then sort by country before the summary/means:
proc sort data=temp;
by country;
run;
Try this:
(added my own datastep, as I never open Office files from the web)
data have;
input country $ fam bdr;
cards;
JPN 0 5
JPN 0 6
JPN 1 3
JPN 1 4
KOR 0 3
KOR 0 2
KOR 1 4
KOR 1 5
;
run;
proc summary data=have;
var bdr;
class fam;
by country;
output
out=want (
drop=_type_
rename=(_freq_=N)
where=(fam ne .)
)
mean(bdr)=mean
median(bdr)=median
max(bdr)=max
min(bdr)=min
;
run;
Thanks for your reply but it do not explain the things that i want. because it only work for the mentioned countries and inclue only 5 observations. anyone here who can open my excel file and explain in more detail?
Post your data in a more sensible and less dangerous format (.csv, for instance).
Or import your excel data into SAS and then create a sample dataset, as described in
Maybe this...?
Proc sort data=your.data;
by country;
run;
proc means data=your.data n mean median max min;
var ...;
class fam;
by country;
run;
It is easy for proc tabulate.
proc import datafile='/folders/myfolders/22.xls' out=have replace dbms=xls;run;
data temp;
set have;
length F $ 20;
if Fam=0 then F='Non-family firms';
else if Fam=1 then F='Family firms';
run;
options nobyline;
title j=l "Country #byval1";
proc tabulate data=temp;
by count;
var book_debt_ratio;
class F;
table F=' ',book_debt_ratio*(N mean median max min);
run;
when i put the complete data which contain 9 countries than it comes up with this error.
ERROR: Data set WORK.TEMP is not sorted in ascending sequence. The current BY group has Count =
JPN and the next BY group has Count = HKG.
Then sort by country before the summary/means:
proc sort data=temp;
by country;
run;
I want to merge two data's. in both excel files the company name are same i have data for 14 years so i want to merge two files in a sense that company name and data for a particular year apear togather. for example i have stock data for 100 companies for 14 years is in one file and total assets data for those 100 companies for 14 years is another file. how can i merge these two files. both the files contain same companies names and same years. Thanks in anticipation.
Before any using of BY statement, the data set has to be sorted:
Proc sort data=your.data;
by country;
run;
I have got my results in the form 10.02 i want to get the results upto 4 points. can you describe how can i take this upto four point like 10.02 to 10.0214
Add a format to the variable, like this:
proc summary data=have;
var bdr;
class fam;
by country;
attrib bdr format=10.4;
output
out=want (
drop=_type_
rename=(_freq_=N)
where=(fam ne .)
)
mean(bdr)=mean
median(bdr)=median
max(bdr)=max
min(bdr)=min
;
run;
The format will be inherited by the statistics.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.