06.03.2015 Views

Stata Quick Reference and Index

Stata Quick Reference and Index

Stata Quick Reference and Index

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Title<br />

format — <strong>Quick</strong> reference for numeric <strong>and</strong> string display formats<br />

Description<br />

This entry provides a quick reference for display formats.<br />

Remarks<br />

The default formats for each of the numeric variable types are<br />

byte %8.0g<br />

int %8.0g<br />

long %12.0g<br />

float %9.0g<br />

double %10.0g<br />

To change the display format for variable myvar to %9.2f, type<br />

format myvar %9.2f<br />

or<br />

format %9.2f myvar<br />

<strong>Stata</strong> will underst<strong>and</strong> either statement.<br />

Four values displayed in different numeric display formats<br />

%9.0g %9.0gc %9.2f %9.2fc %-9.0g %09.2f %9.2e<br />

12345 12,345 12345.00 12,345.00 12345 012345.00 1.23e+04<br />

37.916 37.916 37.92 37.92 37.916 000037.92 3.79e+01<br />

3567890 3567890 3.57e+06 3.57e+06 3567890 3.57e+06 3.57e+06<br />

.9165 .9165 0.92 0.92 .9165 000000.92 9.16e-01<br />

Left-aligned <strong>and</strong> right-aligned string display formats<br />

%-17s %17s<br />

AMC Concord<br />

AMC Pacer<br />

AMC Spirit<br />

Buick Century<br />

Buick Opel<br />

AMC Concord<br />

AMC Pacer<br />

AMC Spirit<br />

Buick Century<br />

Buick Opel<br />

Also see<br />

[U] 12.5 Formats: Controlling how data are displayed<br />

36

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!