6
UsingtheDataEditor
TheDataEditor
TheDataEditorgivesaspreadsheet-likeviewofdatathatarecurrentlyinmemory.Youcanuse
ittoenternewdata,editexistingdata,andeditattributesofthedatainthedataset,suchasvariable
names,labels,anddisplayformats,aswellasvaluelabels.
Inaddition to theviewofthedata, therearetwowindowsformanipulating variablesandtheir
properties:theVariableswindowand thePropertieswindow.Thesearesimilar tothesame-named
windowsinthemainStatawindow.
Any action you take e in n theDataEditor results in a a command d being issued to Stataasthough
you hadtypedit intotheCommand window.Thismeansthatyoucankeep goodrecordsandlearn
commandsbyusingtheDataEditor.
TheDataEditorcanbekeptopenwhileyouworkinStata,givingyoualiveviewofyourdataset
as youwork. To protect t your datafrom m inadvertent t changes, theData a Editor r hastwo modes: edit
modeforactiveeditingandbrowsemodeforviewing.Inbrowsemode,editingwithintheDataEditor
windowisdisabled.WehighlyrecommendthatyouusetheDataEditorinbrowsemodeandswitch
toeditmodeonlywhenyouwanttomakechanges.
Wewillbeenteringandeditingdatainthischapter,aswellasmanipulatingthevariablesbyusing
theVariablesandPropertieswindows,sostarttheDataEditorineditmodebyclickingontheData
Editor(Edit)button,
.
ButtonsontheDataEditor
ThetoolbarfortheDataEditorhassomestandardbuttonsandsomebuttonswehavenotyetseen:
Open:Opens a a Stata dataset.Stata a will warn you if f your current t dataset has unsaved
changes.
Save: SavesthedatasetvisibleintheDataEditor.
Copy: Copiesthecurrent selectiontotheClipboard.
Paste:PastesthecontentsoftheClipboard.Youmaypasteonlyifonecellisselected—this
cell will l become e theupper-left t corner of thepasted contents.Warning:This s action will
pasteoverexistingdata.
EditMode:ChangestheDataEditortoeditmode.
BrowseMode:ChangestheDataEditortobrowsemodeforsafelylookingatdata.
FilterObservations:FilterstheobservationsvisibleintheDataEditor. Thisbuttonisuseful
forlookingat asubsetofthecurrent dataset.
1
Export pdf to powerpoint - Library SDK component:C# Create PDF from PowerPoint Library to convert pptx, ppt to PDF in C#.net, ASP.NET MVC, WinForms, WPF
Online C# Tutorial for Creating PDF from Microsoft PowerPoint Presentation
www.rasteredge.com
Export pdf to powerpoint - Library SDK component:VB.NET Create PDF from PowerPoint Library to convert pptx, ppt to PDF in vb.net, ASP.NET MVC, WinForms, WPF
VB.NET Tutorial for Export PDF file from Microsoft Office PowerPoint
www.rasteredge.com
[GSW]6 Using the Data Editor
YoucanmoveaboutintheDataEditorbyusingthetypicalmethods:
 Tomovetotheright,usetheTab keyortheright t arrowkey.
 Tomovetotheleft,useShift+Tab ortheleftarrowkey.
 Tomovedown,useEnter orthedownarrowkey.
 Tomoveup,useShift+Enterortheuparrowkey.
Youcanalsoclickwithinacell toselectit.
Right-clickingwithintheDataEditorbringsupacontextualmenuthatallowsyou tomanipulate
thedataandwhatyouareviewing.Right-clickingontheDataEditorwindowdisplaysamenufrom
whichyoucandomanycommontasks:
 CopytocopydatatotheClipboard.
 PastetopastedatafromtheClipboard.
 Paste Special... to paste datafrom m the Clipboard with finer r control of delimiters, giving g a
previewofwhatwillbepasted.
 SelectAll toselectallthedatadisplayedintheDataEditor.Thiscouldbedifferent fromthe
datainthedatasetifthedataarefilteredorsomevariablesarehidden.
 Datawhichopensasubmenucontaining
 AddVariable atEndofDataset...tobring upadialogforcreatinganewvariable.
 Replace Contents s of Variable... to bring up p a a dialog g for replacing g the values s of the
selectedvariable.
 SortData... tosortthedatasetbytheselectedvariable.
 Value Labelsto accessasubmenuformanaginganddisplayingvaluelabels.
 KeepOnlySelected Data to keeponlytheselecteddatain thedataset.All remaining
datawillbedropped(removed)fromthedataset.Asalways,thisaffectsonlythedatain
memory.Itwillnotaffect anydataondisk.
 Drop Selected d Data to drop p the e selected data.This is only possible if f the e selection
consistsofeitherentirevariables(columns)orobservations(rows).
 ConvertVariablesfromStringtoNumeric...forconvertingstringvariablestonumeric
variables, which h is useful when the e string g variables contain n characters s for formatting
numbersinsteadofjustnumbers.
 ConvertVariablesfromNumerictoString...forconvertingnumericvariablestostrings.
 EncodeStringVariabletoLabeledNumeric...forencodingastring-valuedcategorical
variabletoanumericvariablewhilestilldisplayingthecategoriesintablesandgraphs.
 Decode Labeled Numeric Variable to o String...for turning g an encoded d variable e back
intoastringvariable.
 HideSelectedVariablestohidetheselectedvariables.
 ShowOnlySelectedVariablestohideall buttheselectedvariables.
 ShowEntireDatasettoturnoffallfiltersandunhideall variables.
 Preferences...tosetthepreferencesfortheDataEditor.
 Font...tochangethefontoftheDataEditor.
Library SDK component:Online Convert PowerPoint to PDF file. Best free online export
Online Powerpoint to PDF Converter. Download Free Trial. Then just wait until the conversion from Powerpoint to PDF is complete and download the file.
www.rasteredge.com
Library SDK component:C# WPF PDF Viewer SDK to convert and export PDF document to other
Viewer & Editor. WPF: View PDF. WPF: Annotate PDF. WPF: Export PDF. WPF: Print PDF. PDF Create. Create PDF from Word. Create PDF from Excel. Create PDF from PowerPoint
www.rasteredge.com
[GSW]6 Using the Data Editor 3
Dataentry
EnteringdataintotheDataEditorissimilartoenteringdataintoaspreadsheet. Onemajordifference
isthattheDataEditor hastheconcept ofobservations,whichmakesthedataentry smart.Wewill
illustratethis with an example.It will l be e useful l for youto follow the e exampleat t your computer.
To work along,youwill needto startwithanempty dataset to work along,sosaveyourdatasetif
necessary,andthentypeclearintheCommandwindow.
Note: Asacheck to seeifyour datahavechanged,typedescribe,short(ord,sfor short).
Statawilltellyouifyourdatahavechanged.
Supposethatwehavethefollowingdata,andwewanttoenterthemintoStata:
Make
Price
MPG
Weight GearRatio
VW Rabbit
4697
25
1930
3.78
Olds 98
8814
21
4060
2.41
Chev. Monza
3667
2750
2.73
AMC Concord
4099
22
2930
3.58
Datsun 510
5079
24
2280
3.54
5189
20
3280
2.93
Datsun 810
8129
21
2750
3.55
Wedonotknow
MPG
forthethirdcarorthemakeofthesixth.
Start by opening theDataEditor inedit mode.You candothiseitherbyclicking on theData
Editor (Edit)button,
,orby typingeditintheCommand window.You shouldbegreetedby
aDataEditorwithnodatadisplayed.(Ifyouseedata,typeclearintheCommandwindow.)Stata
shows theactivecell l by highlighting it and displaying varname[obsnum]next totheinputbox in
theCursorLocationbox.Wewillseebelowthatwecannavigatewithinadatasetbyusingthiscell
reference.TheDataEditorstarts,bydefault,inthefirstrowofthefirst column.Becausethereare
nodata,therearenovariablenames,andsoStatashowsvar1[1]astheactivecell.
Wecan enter these e data either r by working acrossthe e rows (observation n by observation) or by
workingdownthecolumns(variablebyvariable).Toenterthedataobservationbyobservation,press
Tab afterenteringeachvalueuntilyouhavereachedtheendofthefirstrow. Inourcase,wewould
typeVWRabbit, pressTab,type4697, pressTab,and continueentering datatocompletethefirst
observation.
Afteryouarefinishedwiththefirst observation,select thesecondcellinthefirst column,either
byclickingwithinitorby navigatingtoit. Atthispoint,yourscreenshouldlooklikethis:
Library SDK component:VB.NET PDF - Convert PDF with VB.NET WPF PDF Viewer
PDF in WPF. Annotate PDF in WPF. Export PDF in WPF. Print PDF in WPF. PDF Create. Create PDF from Word. Create PDF from Excel. Create PDF from PowerPoint. Create
www.rasteredge.com
Library SDK component:VB.NET PDF Converter Library SDK to convert PDF to other file
PDF Export. |. Home ›› XDoc.PDF ›› VB.NET PDF: PDF Export. for converting MicroSoft Office Word, Excel and PowerPoint document to PDF file in VB
www.rasteredge.com
[GSW]6 Using the Data Editor
Wecannowenterthedataforthesecondobservationinthesamefashionasthefirst—withone
nicedifference:after weenter thelast valueintherow, pressingtheTab b key y will bringusto the
first cellinthethirdrow.Thisispossiblebecausethenumberof variables s isknown afterthefirst
observationhasbeenentered,soStataknowswhenithasallthedataforanobservation.
Wecan entertherestofthedataby pressingtheTab keybetweenentries,simplyskippingover
missingvaluesbytabbingthroughthem.
If we e had d wanted to enter thedatavariable e by y variable, we e could d havedone e that by y pressing
Enter betweeneachmakeofcaruntilallsevenobservationswereentered,skippingpastthemissing
entryby pressingEnter twice.Oncethefirst t variablewasentered, wewouldselectthefirstcell in
thesecondcolumnandenterthepricedata.Wewouldcontinuethisuntilwewerefinished.
Notesondataentry
Thereareseveralthingsto noteaboutdataentryand thefeedbackyougetfromtheDataEditor
asyouenterdata:
 Statadoesnotallowblankcolumnsorrowsinthe middle ofyourdataset.
Whenever you enter new variables or observations, always begin in n thefirst empty y column
orrow.Ifyou skip columns orrows, Statawillfill in theintervening columnsorrowswith
missingvalues.
 Stringsandvaluelabelsare color coded.
To helpdistinguish betweenthedifferent types ofvariablesin theDataEditor, stringvalues
aredisplayedinred,valuelabels(see[
GSW
]9Labelingdata)aredisplayedinblue, andall
othervaluesaredisplayedinblack.Youcanchangethecolorsforstringsandvaluelabelsby
right-clickingontheDataEditorwindowandselectingPreferences....
 Aperiod(.)representsStata’ssystemmissingnumericvalue.
Stata has a system missing value, ‘.’, and d extended missing values ‘.a’ through h ‘.z’.By
default,Statausesitssystemmissingvalue.
 TheTabkeyissmart.
Aswesawabove,afterthefirstobservationhasbeenentered,Stataknowshowmanyvariables
youhave.Soattheendofthesecondobservation(andallsubsequentobservations),Tab will
automaticallytakeyoubackto thefirstcolumn.
 TheCursorLocationboxbothshowslocationandisusedfornavigation.
TheCursorLocationboxgivesthelocationofthecurrentcell.Ifyousee,forexample,var3[4],
thismeansthatthecurrentcellisthefourthobservationofthevariablenamedvar3.Youcan
navigateto a a particular r cell l by y typing g thevariable nameand d the e observation n in n theCursor
Locationbox.Ifyouwantedthesecondobservationofvar1tobetheactivecell,typingvar12
intheCursorLocationbox andpressingEnter wouldtakeyouthere.
 Doublequotesaroundtextareunnecessaryinstringvariables.
OnceStataknowsthat avariableisa a string g variable(it holdstext), thereisnoneed toput
quotesaroundthevalues,even ifthevalueslooklikeanumber.Thus,ifyouwanted toenter
ZIP
codesastext,youwouldenterthefirst
ZIP
codewithquotes("02173"),buttherestwould
not needanyquotes.
 Thearrowkeysarecontextsensitive.
Ifyouselectacellandtypenewdata,usinganarrowkeywillacceptthechangeandmoveto
anewactivecell. Ifyoudouble-clickon acell,youcanedit withinthecell contents. Inthis
case,theright-andleft-arrowkeysmovewithinthecell’sdata.
 Youcanthrowawaychangestoacell.
If,whileyouareenteringdatainacell,youdecideyouwouldliketocancelthechanges,press
theEsckeyorclickoutsidethecell.
Library SDK component:C# PDF Converter Library SDK to convert PDF to other file formats
PDF Export. |. Home ›› XDoc.PDF ›› C# PDF: PDF Export. Able to export PDF document to HTML file. Able to create convert PDF to SVG file.
www.rasteredge.com
Library SDK component:C# HTML5 PDF Viewer SDK to convert and export PDF document to
Export PDF in WPF. Print PDF in WPF. PDF Create. Create PDF from Word. Create PDF from Excel. Create PDF from PowerPoint. Create PDF from Tiff. Create PDF from
www.rasteredge.com
[GSW]6 Using the Data Editor 5
Renamingandformattingvariables
ThedatahavenowbeenenteredintoStata,butthevariablenamesleavesomethingtobedesired:
theyhavethedefaultnamesvar1,var2,:::,var5.Wewouldliketo renamethevariablesso that
theymatchthecolumntitlesfromourdataset.Wewouldalsoliketogivethevariablesdescriptions
andchangetheirformatting.
Wewillstep throughchangingthename,label,andformatofthepricevariable.Wewill then
addanotetothevariable.Startbyclickingonthevar2variableintheVariableswindow. Thefew
propertiesassociatedwithvar2arenowvisibleandeditableinthePropertieswindow.Wemaynow
systematicallychangethepropertiesofvar2toourchoosing:
1. Double-clickonvar2in n theNamefield to select theoldvariablename, andtypepriceto
overwritethename.
2. ClickunderthenewpricenameintheLabel l field.
3. Enteraworthwhilelabel,suchasPriceinDollars.
4. Clickon%9.0gintheFormatfield.
5. Clickontheellipses(:::)buttonthatappears.TheCreateFormatdialogopens.
6. Youcanseeherethattherearemanypossibleformats,mostofwhicharerelatedtotime.We
wantcommasinournumbers,so checktheUsecommasinnumericoutputcheckbox.When
youaredone,clickontheOKbutton.
7. ClickintheNotesfield.
8. Clickontheellipses(:::)buttonthatappears.AdialogcalledNotesforpriceopens.
9. ClickontheAddbuttonandtypeaclevernote.
10. Whenyou u aredonetyping, click on theSubmitbutton, and then click on theClose button.
Thisnoteisnowattachedtothepricevariable.
11. Clickonthedisclosurecontrol l toseethenoteyoujusttypedinthePropertieswindow.
Toeditthepropertiesofanothervariable,clickonthevariableintheVariableswindow.Wecanname
thefirstvariablemake; thethird,mpg; thefourth, weight;and thefifth,gear
ratio.Just before
you renamevar5togear
ratio,yourscreenshouldlooklikethis:
Library SDK component:C# WPF PDF Viewer SDK to view, annotate, convert and print PDF in
Export PDF in WPF. Print PDF in WPF. PDF Create. Create PDF from Word. Create PDF from Excel. Create PDF from PowerPoint. Create PDF from Tiff. Create PDF from
www.rasteredge.com
Library SDK component:VB.NET PDF- HTML5 PDF Viewer for VB.NET Project
PDF in WPF. Annotate PDF in WPF. Export PDF in WPF. Print PDF in WPF. PDF Create. Create PDF from Word. Create PDF from Excel. Create PDF from PowerPoint. Create
www.rasteredge.com
[GSW]6 Using the Data Editor
Youneedtoknowsomerulesforvariablenames:
 Stataiscasesensitive.
Make,make,andMAKEarealldifferentnamestoStata.IfyouhadnamedyourvariablesMake,
Price,MPG,etc.,thenyouwouldhavetotypethemcorrectlycapitalizedinthefuture.Using
alllowercaselettersiseasier.
 Avariablenamemust be1–32characterslong.
 Thecharacterscanbeletters(A–Z,a–z),digits(0–9),orunderscores(
).
 Spacesorothercharactersarenotallowed.
 Thefirst characterofavariablenamemust bealetteroranunderscore.
Although you canusean underscoretobeginavariablename,it ishighlydiscouraged.Such
namesareusedfortemporaryvariablenamesinStata. Youwouldlikeyourdatatobepermanent,
sousingatemporarynamecouldleadtogreatfrustration.
Formoreinformationaboutvariablenamesandvaluelabels,see[
GSW
]9Labelingdata;fordisplay
formats,see[
U
]12.5Formats:Controllinghowdataare displayed.
Copyingandpastingdata
Youcan copyandpastedatabyusing theDataEditor. Thisisoften asimplewayto bringdata
intoStatafromanyotherapplicationssuchasspreadsheetsordatabases.
1. Selectthedatathatyouwishtocopybyusingoneofthesemeans:
 Clickonceonavariablenameorcolumnheadingtoselectanentirecolumn.
 Clickonceonanobservationnumberorrowheadingtoselecttheentirerow.
 Clickanddragthemousetoselect arangeofcells.
2. CopythedatatotheClipboardbyright-clickingwithintheselectedrange,andselectCopy.
3. PastethedatafromtheClipboardbyclickingonthetopleftcelloftheareatowhichyouwish
topaste. Thenright-clickonthesamecell,andselectPaste.
Wewillillustratecopyingand pasting an observationbymaking acopyof thefirst observation
andpastingitattheendofthedataset.
Start by clicking on theobservation number of thefirstobservation. Doing sohighlightsall the
datain therow.Right-click onthesamelocation(thereisnoneedtomovethemouse),and select
Copy:
[GSW]6 Using the Data Editor 7
Click on thefirst cell in theeighth row, right-click whileyou are e still l in that cell,and choose
Pastefromtheresultingmenu. Youcanseethattheobservationwassuccessfullyduplicated.
Notesoncopyingandpasting
 TheaboveexampleillustratedcopyingandpastingwithintheDataEditor.Youcanuseroughly
thesametechniquetocopyandpastebetweenotherapplicationsandStataandbetweenStata
and other applications.Theeasiest way y to see if f copying and d pasting works s properly with
anotherapplicationistotryit.Theonerequirementforthingstoworkwellisthattheexternal
application must t copy y tables in some e delimited d form, as do spreadsheet t applications, many
databaseapplications, and someword processors.Using Edit > Paste Special... gives some
addedflexibilityto theformatsyoucanpasteintotheDataEditor.Ifasimplepastedoesnot
giveyouwhatyouexpected,youshouldtryEdit>PasteSpecial....Formoreinformationon
file-basedmethodsforimportingdataintoStata,see[
GSW
]8Importingdata.
 Ifyouarecopyingandpastingdatawithvaluelabels,youhaveachoice.Youcancopyvariables
with valuelabels as text, using g thevaluelabels s as theactual l values, or you can copy said
variablesastheirunderlyingencodednumbers. Copyingwiththevaluelabelsisthedefault.If
youwouldliketheotherchoice,right-clickintheDataEditorandselectData>ValueLabels
>HideAllValueLabels,orselectTools>ValueLabels>HideAllValueLabels.
Changingdata
Asitsnamesuggests,theDataEditorcanbeusedtoedityourdataset.Aswehaveseenalready,it
canbeusedtoeditthedatathemselvesaswellasthedescriptionanddisplayoptionsforthevariables.
Hereisanexampleformakingsomechangestotheautodataset,whichillustratesbothmethods
forusingtheDataEditoranditsdocumentationtrail.Wewillalsokeepsnapshotsofthedatasetas
weareworkingsothatwecanreverttopreviousversionsofthedatasetincasewemakeamistake.
Wewouldliketoinvestigatethedataset, work withvaluelabels, deletethetrunkvariable,and
makeanew variableshowinggasconsumption per100miles.Thesetaskswillillustratethebasics
ofworkingintheDataEditor.
[GSW]6 Using the Data Editor
Start by typing sysuseautointo theCommand window.If you worked theprevious s example,
youwillgetanerrorandaretoldthatdatainmemorywouldbelost.Thisisgood—Stataiskeeping
youfrominadvertentlythrowingawaytheunsavedchangestoyourcurrentdataasitloadstheauto
dataset.Ifyouwouldliketosavethedatasetyouhavebeenworkingon,selectFile>Saveandsave
thedatasetin an appropriatelocation.Otherwise, typeclearin theCommand window, and press
Enter toclearoutthedata,andthenload thatautodata.
Oncetheautodatasetisloaded,starttheDataEditor.
1. Wewouldliketoseewhichcarshavethelowestandhighestgasmileages.Todothis,right-click
on thecolumn heading g of f thempgcolumn.Select Data > > Sort Data...fromthe e contextual
menu.A dialog will pop up askinghowyou wantto sort,defaulting to sorting in ascending
order.ClickonOK.(Stataworriesaboutsortorderbecausesortordercanaffectreproducibility
whenusingresamplingtechniques. Thisisagoodthing.) Youwillseethatthedatahavenow
been sorted by mpginascendingorder. Thelowest-mileagecarsareatthetopofthescreen;
byscrollingtothebottomofthedataset,youcanfindthehighest-mileagecars.Youalsocould
havesortedbyselectingTools>SortData...oncethempgvariablewasselected.
2. Wewould d liketo investigaterepair records and hencesort by therep78 8 variable. (Do o this
now.)WeseethattheStarfireandFirebirdbothhadpoorrepairrecords,butwewouldliketo
seethecarswithgoodrepairrecords.Wecouldscrolltothebottomofthedataset,butitwill
befastertousetheCursorLocationbox:typerep7874andpressEnter tomakerep78[74]
theactivecell.Wenoticethat thelast fiveentriesfor rep78appear asdots.Thedotsmean
thatthesevaluesaremissing.Afewitemsofnote:
 Aswe can n see e from theresult t of thesort, Stataviewsmissingvaluesasbeing larger
than all numericnonmissingvalues.In technical terms, this meansthat rep78>=.is
equivalent tomissing(rep78).
 WhatwedonotseehereisthatStatahasmultiplemissing-valueindicators: .isStata’s
default or system missing-value indicator, and d .a, .b, :::, .z z are Stata’s extended
missingvalues. Extendedmissingvaluesareusefulforindicatingthereasonwhyavalue
isunknown.
 Thedifferent missing g values sort t among g themselves: .<.a.b< <.z.See
[
U
]12.2.1Missingvaluesforfulldetails.
3. Wewouldliketomaketherepairrecordsreadable.Clickonrep78intheVariableswindow.
4. ClickontheValueLabel l field in thePropertieswindow,and then click on theellipses s (:::)
button that t appears.This opens the Manage Value Labels dialog. . Weneed to definea a new
valuelabelfortherepairrecords.
a. ClickontheCreateLabelbutton.YouwillseetheCreateLabeldialog.
b. Typeanameforthelabel,say,repairs,intheLabelnamebox.
c. PresstheTab keyorclickwithintheValuefield.
d. Type1forthevalue,presstheTab b key,andtypeatrociousforthelabel.
e. PresstheEnter keytocreatethepairing.
f. Repeatstepsdandetomakeallthepairings:2with“bad”,3with“OK”,4with“good”,
and5with“stupendous”.
g. ClickontheOKbuttontofinishcreatingthevaluelabel.
h. Clickonthedisclosurecontrol,
,toshowthelabel—youshouldseethis:
[GSW]6 Using the Data Editor 9
Ifyouhavesomethingelse,youcaneditthelabelbyclickingontheEditLabelbutton.
i. ClickontheClosebuttontoclosetheManageValueLabelsdialog.
Nowthatthelabelhasbeencreated,attachittotherep78variableby clicking onthedown
arrow in n theValueLabel l field d and d selecting the repairs label.You u can now see e the labels
displayedinplaceofthevalues.
5. Supposethat t wefoundtheoriginal sourceofthedatain atimecapsule,sowecouldreplace
someofthemissingvaluesforrep78.Wecouldtypethevaluesintocells. Wecanalsoassign
thevaluesbyright-clickingwithinacellwithamissingvalueandchoosingavaluefromData
>ValueLabels>AssignValuefromValueLabel‘repairs’. Thisstrategycanbeusefulwhen
avaluelabelhasmanypossiblevalues.
6. Wewouldnowliketodeletethetrunkvariable. . Wecandothisbyright-clickingonthetrunk
variablenameat thetopofthecolumnand selectingtheData> DropSelectedDatamenu
item. Becausethiscanleadto dataloss,theDataEditoraskswhetherwewouldliketodrop
theselectedvariable. ClickontheYesbutton.
7. To o finish h up, , wewould liketo createavariable e containing g the e gallons of f gasoline e per r 100
milesdrivenforeachofthecars.
a. Right-click withinany cell,and choosetheData>AddVariableatEndof Dataset...
menuitemtobringupthegeneratedialog.
b. Typegp100mintheVariablenamefield.
c. BeingsurethattheSpecifyavalueoranexpressionradiobuttonisselected,type100/mpg
initsfield.WecouldhaveclickedontheCreate... buttontoopentheExpressionbuilder
dialog, but t this s formulawas simple enough h to type.(You u might t want to explore the
Expressionbuilderrightnowtoseewhatitcando.)
d. ClickonOK.Youcanscrolltotherighttoseethenewlycreatedvariable.
Throughoutthisdataeditingsession,wehavebeenusingtheDataEditortomanipulatethedata.
IfyoulookintheResultswindow,youwillseethecommandsandtheiroutput.Youcanalsoseeall
thecommandsgeneratedbytheDataEditorintheReviewwindow.Ifyouwantedtosavetheediting
commandstouseagainlater,youcoulddothefollowingsteps:
1. ClickintheReviewwindowonthelastcommandthatcamefromtheDataEditor.
2. Scrollup p untilyoufindthesortmpgcommandyouranimmediatelyafteropeningtheData
Editor,andShift-clickonit.
3. Right-clickononeofthehighlightedcommands.
4. SelectSendtoDo-fileEditor.
10 [GSW]6 Using the Data Editor
Thisprocedurewillsaveallthecommandsyouhighlightedinto theDo-fileEditor.Youcould then
savethemasado-file,whichyou couldrunagainlater.Wewilltalkmoreabout theDo-fileEditor
in [
GSW
] 13 Using the Do-file e Editor—automating Stata.You can find help p about do-files s in
[
U
]16Do-files.
Ifyouwanttosavethisdataset,saveitunderanewnamebyusingFile>SaveAs...inthemain
Statawindowtopreventoverwritingtheoriginal dataset.
Workingwithsnapshots
TheDataEditor allowsyouto saveto disk snapshotsofwhatever dataset you areworking on.
Thesearetemporarycopiesof thedataset—theywill bedeleted when you exit Stata,so they need
tobetreatedastemporary.Still,therearemanyusesforsnapshots,suchas
 saving a a temporary y copy of the e data in n memory so that t anotherdataset can n be e opened d and
viewed;
 savingstagesofwork,whichcanberecoveredincaseyoudosomethingdisastrous;and
 savingpiecesofdatasetswhiledoinganalyses.
Wewill keepusing theautodataset fromabove; ifyouarestartinghere,youcanstartfreshby
typingsysuseautointheCommandwindowtoopenthedataset.(Ifyougetawarningaboutdata
inmemorybeinglost,eitheruseclearorsaveyourdata.See[
GSW
]5OpeningandsavingStata
datasetsformoreinformation.)IfweopentheDataEditorandclickontheSnapshotstab,wesee
thefollowingwindow. Ifyouarestartingafresh,youwillseenumbersratherthanlabelsforrep78.
Tobeginwith,onlyonebuttonisactiveintheSnapshotstoolbar. Clickontheactivebutton—the
Add button,
. It brings up adialog asking for a a label, or r name, for the e snapshot. . Give e it an
inventivename, suchasStart, and pressEnter.You can seethat asnapshot isnow listed in the
Snapshots window, andallthebuttonsinthetoolbararenow active.Thefollowingbuttonsappear
intheSnapshotswindow:
Add:Saveanewsnapshotwithatimestampandlabel.
Remove:Eraseasnapshot.Thisaction deletesthe e temporary y snapshot file e but t doesnot
affectthedatainmemory.
Change Label: Edit thelabeloftheselected (highlighted)snapshot.
Documents you may be interested
Documents you may be interested